diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2018-01-26 15:58:53 +0000 |
---|---|---|
committer | P. F. Chimento <philip.chimento@gmail.com> | 2018-03-21 12:14:59 -0700 |
commit | 80408632f1322a44b3094f3dfb6ee6afcdef13dc (patch) | |
tree | b40420f6c239a906f8609ddb040d1b564d35981b /tools/eos-profile-tool/eos-profile-cmds.h | |
parent | 86a999c7f9807d2c369e4658d7e14a8a4257b0b5 (diff) |
Programmatically generate command usage and help
This avoids having each command handle it differently.
Diffstat (limited to 'tools/eos-profile-tool/eos-profile-cmds.h')
-rw-r--r-- | tools/eos-profile-tool/eos-profile-cmds.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/eos-profile-tool/eos-profile-cmds.h b/tools/eos-profile-tool/eos-profile-cmds.h index c6da7d4..1b06db5 100644 --- a/tools/eos-profile-tool/eos-profile-cmds.h +++ b/tools/eos-profile-tool/eos-profile-cmds.h @@ -5,9 +5,23 @@ typedef gboolean (* EosProfileCmdParseArgs) (int argc, char **argv); typedef int (* EosProfileCmdMain) (void); +typedef struct { + const char *name; + const char *description; + const char *usage; + + EosProfileCmdParseArgs parse_args; + EosProfileCmdMain main; +} EosProfileCmd; + +typedef gboolean (* EosProfileCmdCallback) (const EosProfileCmd *cmd, + gpointer data); + gboolean eos_profile_cmd_help_parse_args (int argc, char **argv); int eos_profile_cmd_help_main (void); gboolean eos_profile_cmd_show_parse_args (int argc, char **argv); int eos_profile_cmd_show_main (void); +void eos_profile_foreach_cmd (EosProfileCmdCallback cb, + gpointer data); |