help descriptions now understood by the cog files, no implementation yet, don't try to build this
This commit is contained in:
parent
405ba80d8d
commit
a5a8fb284c
15
include/help.hpp
Normal file
15
include/help.hpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef __HELP_HPP
|
||||||
|
#define __HELP_HPP
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
namespace cellar {
|
||||||
|
namespace help {
|
||||||
|
extern void set_description(string,string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __HELP_HPP
|
@ -22,6 +22,14 @@ DLL_PUBLIC map<string, CommandFunction> cellar::commands::bottles_commands() {
|
|||||||
func = linesplit[1]
|
func = linesplit[1]
|
||||||
|
|
||||||
cog.outl("result.insert(pair<string,CommandFunction>(\"{0}\", &{1}));".format(name, func))
|
cog.outl("result.insert(pair<string,CommandFunction>(\"{0}\", &{1}));".format(name, func))
|
||||||
|
|
||||||
|
if (len(linesplit) > 2):
|
||||||
|
desc = " ".join(linesplit[2:]) # Rest of line assumed to be description
|
||||||
|
cog.outl("cellar::help::set_description(\"{0}\", \"{1}\");"
|
||||||
|
.format(name, desc
|
||||||
|
.replace("\"", "\\\"")
|
||||||
|
.replace("\\", "\\\\")))
|
||||||
|
# the replace methods escape " and \ characters
|
||||||
]]]*/
|
]]]*/
|
||||||
//[[[end]]]
|
//[[[end]]]
|
||||||
return result;
|
return result;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "commands.hpp"
|
#include "commands.hpp"
|
||||||
#include "internal/core.hpp"
|
#include "internal/core.hpp"
|
||||||
#include "cellar.hpp"
|
#include "cellar.hpp"
|
||||||
|
#include "help.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cellar::commands;
|
using namespace cellar::commands;
|
||||||
@ -32,6 +33,14 @@ map<string, CommandFunction> cellar::commands::core_commands() {
|
|||||||
func = linesplit[1]
|
func = linesplit[1]
|
||||||
|
|
||||||
cog.outl("result.insert(pair<string,CommandFunction>(\"{0}\", &{1}));".format(name, func))
|
cog.outl("result.insert(pair<string,CommandFunction>(\"{0}\", &{1}));".format(name, func))
|
||||||
|
|
||||||
|
if (len(linesplit) > 2):
|
||||||
|
desc = " ".join(linesplit[2:]) # Rest of line assumed to be description
|
||||||
|
cog.outl("cellar::help::set_description(\"{0}\", \"{1}\");"
|
||||||
|
.format(name, desc
|
||||||
|
.replace("\"", "\\\"")
|
||||||
|
.replace("\\", "\\\\")))
|
||||||
|
# the replace methods escape " and \ characters
|
||||||
]]]*/
|
]]]*/
|
||||||
//[[[end]]]
|
//[[[end]]]
|
||||||
return result;
|
return result;
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
version print_version
|
version print_version Prints version information.
|
||||||
help help_command
|
help help_command
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "cellar.hpp"
|
#include "cellar.hpp"
|
||||||
#include "internal/core.hpp"
|
#include "internal/core.hpp"
|
||||||
|
#include "help.cpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -22,6 +22,14 @@ DLL_PUBLIC map<string, CommandFunction> cellar::commands::launch_commands() {
|
|||||||
func = linesplit[1]
|
func = linesplit[1]
|
||||||
|
|
||||||
cog.outl("result.insert(pair<string,CommandFunction>(\"{0}\", &{1}));".format(name, func))
|
cog.outl("result.insert(pair<string,CommandFunction>(\"{0}\", &{1}));".format(name, func))
|
||||||
|
|
||||||
|
if (len(linesplit) > 2):
|
||||||
|
desc = " ".join(linesplit[2:]) # Rest of line assumed to be description
|
||||||
|
cog.outl("cellar::help::set_description(\"{0}\", \"{1}\");"
|
||||||
|
.format(name, desc
|
||||||
|
.replace("\"", "\\\"")
|
||||||
|
.replace("\\", "\\\\")))
|
||||||
|
# the replace methods escape " and \ characters
|
||||||
]]]*/
|
]]]*/
|
||||||
//[[[end]]]
|
//[[[end]]]
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user