From: Richard W.M. Jones Date: Sat, 10 Mar 2012 12:26:42 +0000 (+0000) Subject: Implement 'whenjobs --job-names' which lists all loaded jobs. X-Git-Tag: 0.6~7 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=cdfbf1623f1d81cfca15f8efbe2bf444e6b1ef5a;p=whenjobs.git Implement 'whenjobs --job-names' which lists all loaded jobs. --- diff --git a/tools/whenjobs.ml b/tools/whenjobs.ml index cfef9d6..582f259 100644 --- a/tools/whenjobs.ml +++ b/tools/whenjobs.ml @@ -102,6 +102,7 @@ let rec main () = "-e", Arg.Unit (set_mode `Edit), " Edit and upload the script"; "--edit", Arg.Unit (set_mode `Edit), " Edit and upload the script"; "--get", Arg.Unit (set_mode `Get), "var Display the variable"; + "--job-names", Arg.Unit (set_mode `JobNames), " List names of loaded jobs"; "--jobs", Arg.Unit (set_mode `Jobs), " List running jobs"; "-l", Arg.Unit (set_mode `List), " List the script"; "--list", Arg.Unit (set_mode `List), " List the script"; @@ -245,6 +246,10 @@ Options: ); tail arg1 + | Some `JobNames -> + unused_error args "--job-names"; + job_names () + and edit_file () = (* If there is no initial file, create an empty one containing the * tutorial. @@ -447,6 +452,12 @@ and tail serial = (Filename.quote job.Whenproto_aux.job_tmpdir) in exit (Sys.command cmd) +and job_names () = + let client = start_client () in + let names = Whenproto_clnt.When.V1.get_job_names client () in + stop_client client; + Array.iter print_endline names + and unused_error args op = if args <> [] then ( eprintf "whenjobs %s: unused parameters on the command line.\n" op; diff --git a/tools/whenjobs.pod b/tools/whenjobs.pod index 5750646..7c9e8ee 100644 --- a/tools/whenjobs.pod +++ b/tools/whenjobs.pod @@ -127,6 +127,11 @@ C is used. Print the value of a variable. +=item B<--job-names> + +List the names of all loaded jobs (whether they are running or not). +Use I<--jobs> to list running jobs. + =item B<--jobs> List all running jobs.