core command reorganizing, including splitting off help for new help system
This commit is contained in:
parent
06512f0503
commit
5024b69dcb
@ -62,7 +62,7 @@ add_dependencies(launch cog)
|
||||
add_custom_target(cog ALL DEPENDS ${coggedfiles})
|
||||
|
||||
add_executable(cellar ${src}/cellar.cpp ${src}/commands.cpp ${src}/fs.cpp
|
||||
${src}/version.cpp ${src}/output.cpp)
|
||||
${src}/version.cpp ${src}/output.cpp ${src}/help/help.cpp)
|
||||
target_link_libraries(cellar ${Boost_LIBRARIES} bottles launch)
|
||||
add_dependencies(cellar cog) # effectively redundant but a couple of the bin's
|
||||
# files are cogged, so this is mostly for people
|
||||
|
@ -10,7 +10,6 @@ using namespace std;
|
||||
|
||||
namespace cellar {
|
||||
extern void print_header();
|
||||
extern void print_version(int,vector<string>);
|
||||
|
||||
extern bottles::Bottle active_bottle;
|
||||
|
||||
|
@ -14,8 +14,6 @@ namespace cellar {
|
||||
|
||||
void add_command(string, CommandFunction);
|
||||
vector<string> list_commands();
|
||||
|
||||
extern map<string,CommandFunction> core_commands();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,11 +65,6 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
verbose = verbosearg.getValue();
|
||||
|
||||
// hardcoded because it's special
|
||||
for (auto item : commands::core_commands()) {
|
||||
commands::command_map[item.first] = item.second;
|
||||
}
|
||||
// as above, but cogged from src/modules.txt
|
||||
// BULLSHIT: trying to use str.format on this string causes bizarre compiler errors
|
||||
/*[[[cog
|
||||
import cog
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "commands.hpp"
|
||||
#include "internal/core.hpp"
|
||||
#include "cellar.hpp"
|
||||
|
||||
using namespace std;
|
||||
@ -19,26 +20,6 @@ vector<string> cellar::commands::list_commands() {
|
||||
return result;
|
||||
}
|
||||
|
||||
void help_command(int argc, vector<string> argv) {
|
||||
vector<string> commands = list_commands();
|
||||
cellar::print_header();
|
||||
|
||||
cout << "You have these commands:\n" << endl;
|
||||
|
||||
int num_columns = 4;
|
||||
int cur_column = 1;
|
||||
for (string command : commands) {
|
||||
cout << "\t" << command;
|
||||
if (cur_column == num_columns) {
|
||||
cout << endl;
|
||||
cur_column = 1;
|
||||
} else {
|
||||
cur_column++;
|
||||
}
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
map<string, CommandFunction> cellar::commands::core_commands() {
|
||||
map<string, CommandFunction> result;
|
||||
/*[[[cog
|
||||
|
@ -1,2 +1,3 @@
|
||||
core
|
||||
bottles
|
||||
launch
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "cellar.hpp"
|
||||
#include "internal/core.hpp"
|
||||
#include "commands.hpp"
|
||||
#include "output.hpp"
|
||||
#include "version.hpp"
|
||||
@ -42,6 +43,6 @@ string cellar::version::short_version() {
|
||||
//[[[end]]]
|
||||
}
|
||||
|
||||
void cellar::print_version(int argc, vector<string> argv) {
|
||||
void cellar::commands::print_version(int argc, vector<string> argv) {
|
||||
cellar::output::statement(short_version());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user