[pacman-dev] [RFC v3 06/13] paccache: streamline usage function

Gordian Edenhofer gordian.edenhofer at gmail.com
Fri Sep 30 12:58:59 UTC 2016


On Fri, 2016-09-30 at 08:14 -0400, Dave Reisner wrote:
> On Fri, Sep 30, 2016 at 01:47:54PM +0200, Gordian Edenhofer wrote:
> > 
> > Signed-off-by: Gordian Edenhofer <gordian.edenhofer at gmail.com>
> > ---
> >  contrib/paccache.sh.in | 83 ++++++++++++++++++++++++++++++++----
> > --------------
> >  1 file changed, 53 insertions(+), 30 deletions(-)
> > 
> > diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in
> > index 02fae52..78f566f 100644
> > --- a/contrib/paccache.sh.in
> > +++ b/contrib/paccache.sh.in
> > @@ -30,6 +30,17 @@ declare    delim=$'\n' keep=3 movedir= scanarch=
> >  QUIET=0
> >  USE_COLOR='y'
> >  
> > +# gettext initialization
> > +export TEXTDOMAIN='pacman'
> > +export TEXTDOMAINDIR='@localedir@'
> > +
> > +# Determine whether we have gettext; make it a no-op if we do not
> > +if ! type -p gettext >/dev/null; then
> > +	gettext() {
> > +		printf "%s\n" "$@"
> > +	}
> > +fi
> > +
> >  m4_include(../scripts/library/output_format.sh)
> >  m4_include(../scripts/library/parseopts.sh)
> >  
> > @@ -172,36 +183,48 @@ summarize() {
> >  }
> >  
> >  usage() {
> > -	cat <<EOF
> > -${myname} (pacman) v${myver}
> > -
> > -A flexible pacman cache cleaning utility.
> > -
> > -Usage: ${myname} <operation> [options] [targets...]
> > -
> > -  Operations:
> > -    -d, --dryrun          perform a dry run, only finding
> > candidate packages.
> > -    -m, --move <dir>      move candidate packages to "dir".
> > -    -r, --remove          remove candidate packages.
> > -
> > -  Options:
> > -    -a, --arch <arch>     scan for "arch" (default: all
> > architectures).
> > -    -c, --cachedir <dir>  scan "dir" for packages. can be used
> > more than once.
> > -                          (default: read from
> > @sysconfdir@/pacman.conf).
> > -    -f, --force           apply force to mv(1) and rm(1)
> > operations.
> > -    -h, --help            display this help message and exit.
> > -    -i, --ignore <pkgs>   ignore "pkgs", comma-separated.
> > Alternatively, specify
> > -                          "-" to read package names from stdin,
> > newline-
> > -                          delimited.
> > -    -k, --keep <num>      keep "num" of each package in the cache
> > (default: 3).
> > -        --nocolor         remove color from output.
> > -    -q, --quiet           minimize output
> > -    -u, --uninstalled     target uninstalled packages.
> > -    -v, --verbose         increase verbosity. specify up to 3
> > times.
> > -    -z, --null            use null delimiters for candidate names
> > (only with -v
> > -                          and -vv).
> > -
> > -EOF
> > +	printf "%s (pacman) %s\n" "$myname" "$myver"
> > +	echo
> > +	printf -- "$(gettext "A flexible pacman cache cleaning
> > utility")\n"
> > +	echo
> > +	printf -- "$(gettext "Usage: %s <operation> [options]
> > [targets...]")\n" "$0"
> > +	echo
> > +	printf -- "$(gettext "Operations:")\n"
> > +	printf -- "  -d, --dryrun          "
> > +	printf -- "$(gettext "Perform a dry run, only finding
> > candidate packages")\n"
> > +	printf -- "  -m, --move <dir>      "
> > +	printf -- "$(gettext "Move candidate packages to
> > \"dir\"")\n"
> > +	printf -- "  -r, --remove          "
> > +	printf -- "$(gettext "Remove candidate packages")\n"
> > +	echo
> > +	printf -- "$(gettext "Options:")\n"
> > +	printf -- "  -a, --arch <arch>     "
> > +	printf -- "$(gettext "Scan for \"arch\" (default: all
> > architectures)")\n"
> > +	printf -- "  -c, --cachedir <dir>  "
> > +	printf -- "$(gettext "Scan \"dir\" for packages. Can be
> > used more than once.\n\
> > +	                        (default: read from %s).")\n"
> > "@sysconfdir@/pacman.conf"
> > +	printf -- "  -f, --force           "
> > +	printf -- "$(gettext "Apply force to mv(1) and rm(1)
> > operations")\n" "\$srcdir/"
> > +	printf -- "  -h, --help            "
> > +	printf -- "$(gettext "Display this help message and
> > exit")\n"
> > +	printf -- "  -i, --ignore <pkgs>   "
> > +	printf -- "$(gettext "Ignore \"pkgs\", comma-separated.
> > Alternatively, specify\n\
> > +	                        \"-\" to read package names from
> > stdin, newline-\n\
> > +	                        delimited.")\n" "\$srcdir/"
> > +	printf -- "  -k, --keep <num>      "
> > +	printf -- "$(gettext "Keep \"num\" of each package in the
> > cache (default: 3)")\n"
> > +	printf -- "  -q, --quiet           "
> > +	printf -- "$(gettext "Minimize output")\n"
> > +	printf -- "  -u, --uninstalled     "
> > +	printf -- "$(gettext "Target uninstalled packages")\n"
> > +	printf -- "  -v, --verbose         "
> > +	printf -- "$(gettext "Increase verbosity. specify up to 3
> > times.")\n"
> > +	printf -- "  -z, --null            "
> > +	printf -- "$(gettext "Use null delimiters for candidate
> > names (only with -v\n\
> > +	                    and -vv)")\n"
> > +	printf -- "  --nocolor             "
> > +	printf -- "$(gettext "Remove color from output")\n"
> > +	echo
> 
> I'm going to need convincing that this fits the definition of
> "streamlined" compared to the current implementation.
> 
>   stream·line
>   /ˈstrēmˌlīn/
> 
>   1.  design or provide with a form that presents very little
> resistance to a
>       flow of air or water, increasing speed and ease of movement.
>   2.  make (an organization or system) more efficient and effective
> by
>       employing faster or simpler working methods.
> 
> This is neither faster, nor simpler, nor more efficient or effective.
> It certainly doesn't have lower resistance.

Unifying the syntax of the various contrib scripts will make it easier
to amend them because you don't have to honor some random style choice
from the initial author. I guess most of you are more familiar with how
things are done in makepkg than you are with any script in contrib.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20160930/706a7887/attachment-0001.asc>


More information about the pacman-dev mailing list