Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flux-version: make flux --version an alias, add manpage #2412

Merged
merged 4 commits into from Sep 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/man1/Makefile.am
Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions 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: <http://github.com/flux-framework>


COPYRIGHT
---------
include::COPYRIGHT.adoc[]

3 changes: 3 additions & 0 deletions doc/man1/flux.adoc
Expand Up @@ -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
-----------------------
Expand Down
7 changes: 7 additions & 0 deletions src/cmd/flux.c
Expand Up @@ -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",
},
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 14 additions & 0 deletions t/t0010-generic-utils.t
Expand Up @@ -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()
{
Expand Down