core command reorganizing, including splitting off help for new help system
This commit is contained in:
		@@ -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());
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user