summaryrefslogtreecommitdiffstats
path: root/eurephiadm/commands.h
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2008-12-04 11:38:48 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2008-12-04 11:38:48 +0100
commitb70e51fe3c4bd225ad9815b3660e663e9f3766ec (patch)
tree82f32add17df0af52b613d0f43b3ce8146f6f5eb /eurephiadm/commands.h
parent50b32828f5a6dad74c389fd8545b9513791c9e94 (diff)
downloadeurephia-b70e51fe3c4bd225ad9815b3660e663e9f3766ec.tar.gz
eurephia-b70e51fe3c4bd225ad9815b3660e663e9f3766ec.tar.xz
eurephia-b70e51fe3c4bd225ad9815b3660e663e9f3766ec.zip
Improved help functionality
Now each command can (should!) add a help function. This is done by editing commands.h to add the function name for the function printing out the help text. Added help text for the config command. This help function will be called when eurephiadm is called with: eurephiadm -h <command> eurephiadm --help <command> eurephiadm help <command> In addition the command function should also parse arguments and call the help function when --help or -h argument is given, like eurephiadm config -h eurephaidm config --help
Diffstat (limited to 'eurephiadm/commands.h')
-rw-r--r--eurephiadm/commands.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/eurephiadm/commands.h b/eurephiadm/commands.h
index a8bafe5..95ae9cf 100644
--- a/eurephiadm/commands.h
+++ b/eurephiadm/commands.h
@@ -30,7 +30,7 @@ typedef struct {
char *accesslvl;
char *arghint;
char *helpinfo;
- char *helpdescr;
+ void (*helpfunc)(void);
int (*function)(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *, int argc, char **argv);
} eurephiadm_functions;
@@ -40,8 +40,10 @@ int cmd_Logout(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *cfg, int argc,
int cmd_ShowCfg(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *cfg, int argc, char **argv);
-/* Commands listed are found in ./commands/{command}.c files - one file per command*/
+/* Commands and help functions listed here are found in ./commands/{command}.c files - one file per command*/
int cmd_ListUsers(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *cfg, int argc, char **argv);
+
+void help_EditConfig();
int cmd_EditConfig(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *cfg, int argc, char **argv);
@@ -66,7 +68,7 @@ static const eurephiadm_functions cmdline_functions[] = {
"List only config file settings", NULL, cmd_ShowCfg},
{"config", 1, "config", "[-s|-d] <key>",
- "Add, delete or show one config setting", NULL, cmd_EditConfig},
+ "Add, delete or show one config setting", help_EditConfig, cmd_EditConfig},
// End of records marker
{NULL, 0, NULL, NULL,