@@ -41,8 +41,8 @@ struct optparse_option eventlog_opts[] = {
4141 "(default if omitted), 'never', or 'auto' (default)."
4242 },
4343 { .name = "path" , .key = 'p' , .has_arg = 1 , .arginfo = "PATH" ,
44- .usage = "Specify alternate eventlog path suffix "
45- "(e.g. \"guest.exec.eventlog\")" ,
44+ .usage = "Specify alternate eventlog name or path suffix "
45+ "(e.g. \"exec\", \"output\", or \" guest.exec.eventlog\")" ,
4646 },
4747 OPTPARSE_TABLE_END
4848};
@@ -78,8 +78,8 @@ struct optparse_option wait_event_opts[] = {
7878 "(default if omitted), 'never', or 'auto' (default)."
7979 },
8080 { .name = "path" , .key = 'p' , .has_arg = 1 , .arginfo = "PATH" ,
81- .usage = "Specify alternate eventlog path suffix "
82- "(e.g. \"guest.exec.eventlog\")" ,
81+ .usage = "Specify alternate eventlog name or path suffix "
82+ "(e.g. \"exec\", \"output\", or \" guest.exec.eventlog\")" ,
8383 },
8484 { .name = "waitcreate" , .key = 'W' , .has_arg = 0 ,
8585 .usage = "If path does not exist, wait for its creation" ,
@@ -96,6 +96,31 @@ struct eventlog_ctx {
9696 struct eventlog_formatter * evf ;
9797};
9898
99+ struct path_shortname {
100+ const char * name ;
101+ const char * path ;
102+ };
103+
104+ /* Set of shorthand names for common job eventlog paths:
105+ */
106+ struct path_shortname eventlog_paths [] = {
107+ { "exec" , "guest.exec.eventlog" },
108+ { "output" , "guest.output" },
109+ { "input" , "guest.input" },
110+ { NULL , NULL },
111+ };
112+
113+ const char * path_lookup (const char * name )
114+ {
115+ const struct path_shortname * path = eventlog_paths ;
116+ while (path -> name ) {
117+ if (streq (name , path -> name ))
118+ return path -> path ;
119+ path ++ ;
120+ }
121+ return name ;
122+ }
123+
99124static void formatter_parse_options (optparse_t * p ,
100125 struct eventlog_formatter * evf )
101126{
@@ -169,7 +194,7 @@ int cmd_eventlog (optparse_t *p, int argc, char **argv)
169194
170195 ctx .jobid = argv [optindex ++ ];
171196 ctx .id = parse_jobid (ctx .jobid );
172- ctx .path = optparse_get_str (p , "path" , "eventlog" );
197+ ctx .path = path_lookup ( optparse_get_str (p , "path" , "eventlog" ) );
173198 ctx .p = p ;
174199
175200 if (!(ctx .evf = eventlog_formatter_create ()))
@@ -341,7 +366,7 @@ int cmd_wait_event (optparse_t *p, int argc, char **argv)
341366 ctx .id = parse_jobid (ctx .jobid );
342367 ctx .p = p ;
343368 ctx .wait_event = argv [optindex ++ ];
344- ctx .path = optparse_get_str (p , "path" , "eventlog" );
369+ ctx .path = path_lookup ( optparse_get_str (p , "path" , "eventlog" ) );
345370 timeout = optparse_get_duration (p , "timeout" , -1.0 );
346371 if (optparse_hasopt (p , "waitcreate" ))
347372 flags |= FLUX_JOB_EVENT_WATCH_WAITCREATE ;
0 commit comments