;run: refuse to read commands from stdin if one of the input files was -
This commit is contained in:
parent
9c63b36d88
commit
4dbeac284c
@ -82,7 +82,12 @@ run defaultJournalOverride findBuiltinCommand cliopts@CliOpts{rawopts_=rawopts}
|
|||||||
let args = dbg1 "args" $ listofstringopt "args" rawopts
|
let args = dbg1 "args" $ listofstringopt "args" rawopts
|
||||||
isTerminal <- isStdinTerminal
|
isTerminal <- isStdinTerminal
|
||||||
if args == [] && not isTerminal
|
if args == [] && not isTerminal
|
||||||
then runREPL key findBuiltinCommand
|
then do
|
||||||
|
inputFiles <- journalFilePathFromOpts cliopts
|
||||||
|
let journalFromStdin = any (== "-") $ map (snd . splitReaderPrefix) $ NE.toList inputFiles
|
||||||
|
if journalFromStdin
|
||||||
|
then error' "'run' can't read commands from stdin, as one of the input files was stdin as well"
|
||||||
|
else runREPL key findBuiltinCommand
|
||||||
else do
|
else do
|
||||||
-- Check if arguments could be interpreted as files.
|
-- Check if arguments could be interpreted as files.
|
||||||
-- If not, assume that they are commands specified directly on the command line
|
-- If not, assume that they are commands specified directly on the command line
|
||||||
|
|||||||
@ -9,6 +9,12 @@ $ hledger run -f- register cash
|
|||||||
>2 /hledger: Error: 'run' expects '--' before first command, found none/
|
>2 /hledger: Error: 'run' expects '--' before first command, found none/
|
||||||
>=1
|
>=1
|
||||||
|
|
||||||
|
# ** 0. Run refuses to read input file and commands from stdin
|
||||||
|
<
|
||||||
|
$ hledger run -f-
|
||||||
|
>2 /hledger: Error: 'run' can't read commands from stdin, as one of the input files was stdin as well/
|
||||||
|
>=1
|
||||||
|
|
||||||
# ** 0. Run one command from command line
|
# ** 0. Run one command from command line
|
||||||
<
|
<
|
||||||
2017-01-01 groceries
|
2017-01-01 groceries
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user