Add check to ensure a valid program

break
noctuid 8 years ago
parent 37224947e5
commit bc46d9dcab

@ -38,7 +38,7 @@ alt + s
tdrop -ma -w -4 -y "$PANEL_HEIGHT" -s dropdown termite
#+END_EXAMPLE
The positional argument
The positional argument should be the name of a program in =$PATH= (as opposed to the full path to a program) and should not contain any flags (see =-f= if you want to pass additional flags to the program when running it).
** Basic Flags
=-s= / =--session= should only be used for supported terminals and if the user wants to start a tmux or tmuxinator session. =-a= / =--auto-detect-wm= should be used to automatically set certain options (=-l=, =-L=, =-d=, and/or =-i=) based on the current window manager. These flags (whether automatically or manually set) may be necessary for tdrop to behave correctly (e.g. they are required for =-w= / =--width=, =-h= / =--height=, =-x= / =--xoff=, and =-y= / =--yoff= to work correctly on tiling window managers). See the manpage for these flags for specific details.

@ -161,6 +161,13 @@ done
shift "$((OPTIND-1))"
program=$1
# check that the program is not a path and does not contain flags
if ! type "$program" 2> /dev/null; then
echo >&2 "The program should be in PATH and not contain flags." | \
tee -a "$MUTDROP_PATH"/log
exit 1
fi
if [[ $# -ne 1 ]]; then
echo >&2 "Exactly 1 positional argument is required." \
"For help use -h or --help or see the manpage." | \

Loading…
Cancel
Save