Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion fpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ done
BASEDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

PYTHONCMD="python"
NONINTERACTIVE=false

function doProgram {
# process input from pipe and store as pickled file
Expand All @@ -34,7 +35,7 @@ function doProgram {
$PYTHONCMD "$BASEDIR/src/choose.py" "$@" < /dev/tty
# Determine if running from within vim shell
IFLAG=""
if [ -z "$VIMRUNTIME" ]; then
if [ -z "$VIMRUNTIME" -a "$NONINTERACTIVE" = false ]; then
IFLAG="-i"
fi
# execute the output bash script. For zsh or bash
Expand Down Expand Up @@ -67,6 +68,8 @@ for opt in "$@"; do
exit 0
elif [ "$opt" == "--record" -o "$opt" == "-r" ]; then
echo "Recording input and output..."
elif [ "$opt" == "--non-interactive" -o "$opt" == "-ni" ]; then
NONINTERACTIVE=true
elif [ "$opt" == "--keep-open" -o "$opt" == "-ko" ]; then
# allow control-c to exit the loop
# http://unix.stackexchange.com/a/48432
Expand Down
13 changes: 13 additions & 0 deletions src/screenFlags.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ def getDisableFileChecks(self):
def getAllInput(self):
return self.args.all_input

def getIsNonInteractive(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not used but i guess we can keep it here for consistency

return self.args.non_interactive

@staticmethod
def getArgParser():
parser = argparse.ArgumentParser(prog='fpp')
Expand Down Expand Up @@ -102,6 +105,16 @@ def getArgParser():
help='''You may force PathPicker to recognize all
lines as acceptible input. Typically, PathPicker will scan the input for references
to file paths. Passing this option will disable those scans and the program will assume that every input line is a match. In practice, this option allows for input selection for a variety of sources that would otherwise be unsupported -- git branches, mercurial bookmarks, etc.''')
parser.add_argument('-ni',
'--non-interactive',
default=False,
action="store_true",
help='''Normally, the command that runs after you've
chosen files to operate on is spawned in an interactive subshell. This allows you
to use aliases and have access to environment variables defined in your startup
files, but can have strange side-effects when starting and stopping jobs
and redirecting inputs. Using this flag runs your commands in a non-interactive subshell,
like a normal shell script.''')
return parser

@staticmethod
Expand Down