Line data Source code
1 : #include "../fd_config.h" 2 : #include "../fd_action.h" 3 : 4 : #include <unistd.h> 5 : 6 : extern char const * FD_APP_NAME; 7 : extern char const * FD_BINARY_NAME; 8 : 9 : extern action_t * ACTIONS[]; 10 : 11 : void 12 : help_cmd_fn( args_t * args FD_PARAM_UNUSED, 13 0 : config_t * config FD_PARAM_UNUSED ) { 14 0 : FD_LOG_STDOUT(( "%s control binary\n\n", FD_APP_NAME )); 15 0 : FD_LOG_STDOUT(( "Usage: %s <SUBCOMMAND> [OPTIONS]\n\n", FD_BINARY_NAME )); 16 0 : FD_LOG_STDOUT(( "\nOPTIONS:\n" )); 17 : /* fdctl does not have many flag arguments so we hard-code the 18 : --config parameter. */ 19 0 : FD_LOG_STDOUT(( " --config <PATH> Path to config TOML file\n" )); 20 0 : FD_LOG_STDOUT(( " --version Show the current software version\n" )); 21 0 : FD_LOG_STDOUT(( " --help Print this help message\n\n" )); 22 0 : FD_LOG_STDOUT(( "SUBCOMMANDS:\n" )); 23 0 : for( ulong i=0UL; ACTIONS[ i ]; i++ ) { 24 0 : FD_LOG_STDOUT(( " %13s %s\n", ACTIONS[ i ]->name, ACTIONS[ i ]->description )); 25 0 : } 26 0 : } 27 : 28 : action_t fd_action_help = { 29 : .name = "help", 30 : .args = NULL, 31 : .fn = help_cmd_fn, 32 : .perm = NULL, 33 : .description = "Print this help message", 34 : .is_help = 1, 35 : .is_immediate = 1, 36 : .is_diagnostic = 1, 37 : };