From 43fb4013fe1b5bbbea607855bdaf8e0d4ac153e0 Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" Date: Mon, 30 Sep 2019 00:07:08 +0000 Subject: [PATCH 1/4] cmd/flux: add -V, --version Add a convenience option -V, --version which simply execs flux-version. --- src/cmd/flux.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cmd/flux.c b/src/cmd/flux.c index 9e53deebb6cb..d4d0ec9facf7 100644 --- a/src/cmd/flux.c +++ b/src/cmd/flux.c @@ -42,6 +42,9 @@ static struct optparse_option opts[] = { { .name = "verbose", .key = 'v', .has_arg = 0, .usage = "Be verbose about environment and command search", }, + { .name = "version", .key = 'V', .has_arg = 0, + .usage = "Display command and component versions", + }, { .name = "parent", .key = 'p', .has_arg = 0, .usage = "Set environment of parent instead of current instance", }, @@ -125,6 +128,10 @@ int main (int argc, char *argv[]) usage (p); // N.B. accesses "conf_flags" exit (0); } + if (optparse_hasopt (p, "version")) { + execlp ("flux", "flux", "version", (char *) NULL); + log_err_exit ("Failed to run flux-version"); + } optindex = optparse_option_index (p); if (argc - optindex == 0) { usage (p); From b660be25af5945d9490ace85fa22010bf0b64b4c Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" Date: Mon, 30 Sep 2019 00:07:50 +0000 Subject: [PATCH 2/4] doc: document flux -V, --version Add -V, --version blurb to flux(1) manpage. --- doc/man1/Makefile.am | 3 ++- doc/man1/flux.adoc | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/man1/Makefile.am b/doc/man1/Makefile.am index fd1c364921c2..0b547b858c83 100644 --- a/doc/man1/Makefile.am +++ b/doc/man1/Makefile.am @@ -20,7 +20,8 @@ MAN1_FILES_PRIMARY = \ flux-cron.1 \ flux-user.1 \ flux-event.1 \ - flux-mini.1 + flux-mini.1 \ + flux-version.1 # These files are generated as roff .so includes of a primary page. # A2X handles this automatically if mentioned in NAME section diff --git a/doc/man1/flux.adoc b/doc/man1/flux.adoc index 4e89108db377..580ca470c981 100644 --- a/doc/man1/flux.adoc +++ b/doc/man1/flux.adoc @@ -38,6 +38,9 @@ in the parent. This option may be specified multiple times. *-v, --verbose*:: Display command environment, and the path search for 'CMD'. +*-V, --version*:: +Convenience option to run flux-version(1). + SUB-COMMAND ENVIRONMENT ----------------------- From 357573f6c97dcff16af565fc405bbf3a327b4521 Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" Date: Mon, 30 Sep 2019 00:11:28 +0000 Subject: [PATCH 3/4] testsuite: test flux -V, --version Ensure that flux -V, --version works the same as `flux version`. --- t/t0010-generic-utils.t | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/t/t0010-generic-utils.t b/t/t0010-generic-utils.t index d4fab5f06c46..02a7c82e8488 100755 --- a/t/t0010-generic-utils.t +++ b/t/t0010-generic-utils.t @@ -42,6 +42,20 @@ test_expect_success 'version: reports expected values not under an instance' ' ! grep -q broker version2.out && ! grep -q FLUX_URI version2.out ' +test_expect_success 'version: flux -V works under an instance' ' + flux --version >version3.out && + grep -q libflux-core version3.out && + grep -q commands version3.out && + grep -q broker version3.out && + grep -q FLUX_URI version3.out +' +test_expect_success 'version: flux -V works not under and instance' ' + (unset FLUX_URI; flux -V >version4.out) && + grep -q libflux-core version4.out && + grep -q commands version4.out && + ! grep -q broker version4.out && + ! grep -q FLUX_URI version4.out +' heaptrace_error_check() { From 013980c2c4b421af9f566d38c3f9677f02f9e5f4 Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" Date: Mon, 30 Sep 2019 00:13:40 +0000 Subject: [PATCH 4/4] doc: add manpage for flux-version Add a manpage for flux-version(1) so that `version` appears by default in `flux help` output list of useful commands. Fixes #2348 --- doc/man1/flux-version.adoc | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 doc/man1/flux-version.adoc diff --git a/doc/man1/flux-version.adoc b/doc/man1/flux-version.adoc new file mode 100644 index 000000000000..d68e1e268760 --- /dev/null +++ b/doc/man1/flux-version.adoc @@ -0,0 +1,39 @@ +// flux-help-description : Display flux version information +FLUX-VERSION(1) +=============== +:doctype: manpage + + +NAME +---- +flux-version - Display flux version information + + +SYNOPSIS +-------- +*flux* *version* + + +DESCRIPTION +----------- +flux-version(1) prints version information for flux components. +At a minimum, the version of flux commands and the currently linked +libflux-core.so library is displayed. If running within an instance, +the version of the flux-broker found and FLUX_URI are also included. +Finally, if flux is compiled against flux-security, then the version +of the currently linked libflux-security is included. + +AUTHOR +------ +This page is maintained by the Flux community. + + +RESOURCES +--------- +Github: + + +COPYRIGHT +--------- +include::COPYRIGHT.adoc[] +