diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-23 14:23:02 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-23 19:44:04 -0400 |
commit | 8068e0fbd04085eb7982836e5ebda84d0156fd53 (patch) | |
tree | 7cbbefb5b8b673aec1e4f102f6ef4a208501484c /src/librefetch | |
parent | 5b811ff67eab32f194d939c4d15c87b0c3675e90 (diff) |
librefetch: tidy up: use prose(), remove --version, remove $MAKEPKG
Diffstat (limited to 'src/librefetch')
-rwxr-xr-x | src/librefetch/librefetch | 64 |
1 files changed, 27 insertions, 37 deletions
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index e9e45fd..19942ef 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -27,51 +27,46 @@ trap cleanup EXIT cmd=${0##*/} usage() { - print "Usage: %s [options] <source-url> [<output-file>]" "$cmd" + print "Usage: %s [OPTIONS] SOURCE_URL [OUTPUT_FILE]" "$cmd" print "Usage: %s -[g|P|V|h]" "$cmd" print "Downloads or creates a liberated source tarball." echo - print "The default mode is to create <output-file>, first by trying download" - print "mode, then create mode." + prose "The default mode is to create OUTPUT_FILE, first by trying + download mode, then create mode." echo - print "If <output-file> isn't specified, it defaults to the non-directory" - print "part of <source-url>, in the current directory." + prose "If OUTPUT_FILE isn't specified, it defaults to the non-directory + part of SOURCE_URL, in the current directory." echo - print "In download mode, the glob '*://' is stripped from the beginning of" - print "<source-url>, and the resulting path is attempted to be downloaded" - print "from the configured mirror." + prose "In download mode, the glob '*://' is stripped from the beginning + of SOURCE_URL, and the resulting path is attempted to be + downloaded from the configured mirror." echo - print "In create mode, it looks at a build script, and uses that to create" - print "the source tarball. <source-url> is ignored, except that it is used" - print "to set the default value of <output-file>." + prose "In create mode, it looks at a build script, and uses that to + create the source tarball. SOURCE_URL is ignored, except that it + is used to set the default value of OUTPUT_FILE." echo - print "The default build script is 'PKGBUILD', or 'SRCBUILD' if it exists." + prose "The default build script is 'PKGBUILD', or 'SRCBUILD' if it + exists." echo - print "Unrecognized options are passed straight to makepkg." + prose "Unrecognized options are passed straight to makepkg." + echo + prose "%s does NOT support getopt-style flag combining. You must use + '-a -b', not '-ab'." "$cmd" echo print "Example usage:" print ' $ %s libre://mypackage-1.0.tar.gz' "$cmd" echo print "Options:" print " Settings:" - print " -C Force create mode (don't download)" - print " -D Force download mode (don't create)" - print " -p <file> Use an alternate build script (instead of 'PKGBUILD')" - print " If an SRCBUILD exists in the same directory, it is used" - print " instead" + flag "-C" "Force create mode (don't download)" + flag "-D" "Force download mode (don't create)" + flag "-p <$(_ FILE)>" "Use an alternate build script (instead of + 'PKGBUILD') If an SRCBUILD exists in the same + directory, it is used instead" print " Alternate modes:" - print " -g, --geninteg Generage integrity checks for source files" - print " -P, --print Print the effective build script (SRCBUILD)" - print " -V, --version Show version information" - print " -h, --help Show this message" -} - -version() { - print "librefetch (libretools) beta 4" - echo - print "Copyright (C) 2013 Luke Shumaksr <lukeshu@sbcglobal.net>" - print "This is free software; see the source for copying conditions." - print "There is NO WARRANTY, to the extent permitted by law." + flag "-g, --geninteg" "Generage integrity checks for source files" + flag "-P, --print" "Print the effective build script (SRCBUILD)" + flag "-h, --help" "Show this message" } main() { @@ -81,12 +76,8 @@ main() { mode=download-create parse_options "$@" - # Mode: version, help ################################################## + # Mode: help ########################################################### - if [[ $mode =~ version ]]; then - version - return 0 - fi if [[ $mode =~ help ]]; then usage return 0 @@ -179,7 +170,7 @@ main() { # sets the variables BUILDFILE, makepkg_opts, extra_opts, mode parse_options() { # Detect makepkg options that take a second argument - local makepkg_orig="$(which "${MAKEPKG:-makepkg}")" + local makepkg_orig="$(which makepkg)" local makepkg_opt2long=($("${makepkg_orig}" -h | sed -rn 's/\s*(--\S*) <.*/\1/p')) local makepkg_opt2short=($("${makepkg_orig}" -h | sed -rn 's/\s*(-.) <.*/\1/p')) @@ -204,7 +195,6 @@ parse_options() { -g|--geninteg) mode=checksums;; -P|--print) mode=print;; -p) BUILDFILE="$(readlink -m -- "$opt")";; - -V|--version) mode=version;; -h|--help) mode=help;; -*) makepkg_opts+=("$arg") |