diff --git a/include/internal/core.hpp.cog b/include/internal/core.hpp.cog new file mode 100644 index 0000000..1549e9d --- /dev/null +++ b/include/internal/core.hpp.cog @@ -0,0 +1,28 @@ +// vim: filetype=cpp : +#ifndef __INTERNAL_CORE_HPP +#define __INTERNAL_CORE_HPP +#pragma once + +#include +#include + +#include "commands.hpp" + +using namespace cellar::commands; + +namespace cellar { + namespace commands { + /*[[[cog + import cog + + with open("src/commands.txt") as commandsfile: + for line in commandsfile: + item = line.strip().split(" ") + cog.outl("extern void {0} (int, vector);".format(item[1])) + ]]]*/ + //[[[end]]] + extern map core_commands(); + } +} + +#endif // __INTERNAL_CORE_HPP diff --git a/src/help/help.cpp b/src/help/help.cpp new file mode 100644 index 0000000..4cec2a8 --- /dev/null +++ b/src/help/help.cpp @@ -0,0 +1,27 @@ +#include +#include + +#include "cellar.hpp" +#include "internal/core.hpp" + +using namespace std; + +void cellar::commands::help_command(int argc, vector argv) { + vector 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; +}