diff --git a/lpf.1 b/lpf.1 index 7f240ef..70d7573 100644 --- a/lpf.1 +++ b/lpf.1 @@ -3,7 +3,7 @@ lpf \- Build non-redistributable rpms .SH SYNOPSIS -.B lpf [options] +.B lpf [-n] [options] .SH DESCRIPTION Builds and installs non-redistributable rpms by downloading binaries, @@ -30,7 +30,7 @@ below. .PP If DISPLAY is defined in the environment, lpf uses GUI dialogs for user interaction even when invoked from command line. To force CLI only -operation, unset DISPLAY. +operation, use the -n flag or unset DISPLAY. .PP lpf has a notification system for packages needing to be updated. See NOTIFICATIONS below. @@ -157,4 +157,3 @@ sudo(8) .TP pkexec(1) Used to add user to pkg-build group at initial run. - diff --git a/scripts/lpf b/scripts/lpf index 14df048..00af10f 100755 --- a/scripts/lpf +++ b/scripts/lpf @@ -10,7 +10,7 @@ source $scriptdir/lpf-defs.bash function usage() { cat << EOF -Usage: lpf [args] +Usage: lpf [-n] [args] commands: list List all packages. @@ -41,8 +41,8 @@ commands: Re-enable notification messages for a possibly muted package. -Unset \$DISPLAY to disable GUI dialogs. See the manpage for more commands -and other info. +Use the -n flag or unset \$DISPLAY to disable GUI dialogs. See the manpage for +more commands and other info. EOF } @@ -230,6 +230,17 @@ export NO_AT_BRIDGE=0 export SUDO_ASKPASS=$scriptdir/sudo_askpass +# parse basic flags with getopts +while getopts "hn" opt; do + # shellcheck disable=2220 + case $opt in + h) usage; exit;; + n) unset DISPLAY;; + esac +done +shift "$((OPTIND-1))" + +# now fall through to command parsing command=$1 shift case $command in