OpenAFS Master Repository branch, openafs-stable-1_8_x, updated. openafs-stable-1_8_5-38-g74b7b94

Gerrit Code Review gerrit@openafs.org
Sun, 9 Feb 2020 12:41:30 -0500


The following commit has been merged in the openafs-stable-1_8_x branch:
commit 74b7b948229af1a12938d06b1ec892562a2a573e
Author: Michael Meffie <mmeffie@sinenomine.net>
Date:   Fri Apr 4 10:27:10 2014 -0400

    cmd: improve help for programs without subcommands
    
    Some programs do not have subcommands (other than the standard "help",
    and "version" subcommands).  The cmd library provides the "noopcode"
    mechanism for new subcommand-less programs, but older programs take
    advantage of the optional "initcmd" token to simulate subcommand-less
    programs.  The "initcmd" token is optional to run the command, however
    it is required to display the command help.
    
    For example, running the xstat_cm_test program without any options gives
    a syntax error:
    
        $ xstat_cm_test
        xstat_cm_test: Missing required parameter '-cmname'
        ...
    
    Retrying with -help (or help, -h, --help), gives the rather unhelpful
    output:
    
        $ xstat_cm_test -help
        xstat_cm_test: Commands are:
        apropos         search by help text
        help            get help on commands
        initcmd         initialize the program
    
    It is not obvious to the user how to get the command usage for the
    program, nor that the initcmd subcommand to "initialize the program" is
    actually is a placeholder to run the program.
    
    Instead, display the command usage when help is requested and initcmd is
    the only defined subcommand for a program.
    
    For example:
    
        $ xstat_cm_test -help
        Usage: src/xstat/xstat_cm_test [initcmd]
                 -cmname <Cache Manager name(s) to monitor>+
                 -collID <Collection(s) to fetch>+ [-onceonly]
                 [-frequency <poll frequency, in seconds>]
                 [-period <data collection time, in minutes>] [-debug] [-help]
        Where: -onceonly  Collect results exactly once, then quit
               -debug     turn on debugging output
    
    The libcmd library now supports an "noopcode", which should used for
    future subcommand-less programs, but converting old programs to remove
    the initcmd opcode could break scripts which actually specify the
    optional initcmd token.
    
    This commit adds a new libcmd flag called CMD_IMPLICIT which is used to
    denote built-in subcommands such as "version" and "help".
    
    Reviewed-on: https://gerrit.openafs.org/10983
    Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
    (cherry picked from commit 77ae3dc899e89f327328c874628f100a765846c4)
    
    Change-Id: I5b31f12f844f14e6cf31ee28c1eb60c98fcf4b59
    Reviewed-on: https://gerrit.openafs.org/13894
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
    Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
    Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
    Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>

 src/cmd/cmd.c   |   48 ++++++++++++++++++++++++++++++++++++------------
 src/cmd/cmd.p.h |    1 +
 2 files changed, 37 insertions(+), 12 deletions(-)

-- 
OpenAFS Master Repository