From 02571218bdba3785fb13b6cbd4c39a0c01091b3c Mon Sep 17 00:00:00 2001 From: Nicholas O'Connor Date: Fri, 24 Mar 2017 22:06:03 -0700 Subject: [PATCH] git commit -a doesn't add untracked files, you idiot stoner --- include/internal/core.hpp.cog | 28 ++++++++++++++++++++++++++++ src/help/help.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 include/internal/core.hpp.cog create mode 100644 src/help/help.cpp 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; +}