;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
|
||||
isTerminal <- isStdinTerminal
|
||||
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
|
||||
-- Check if arguments could be interpreted as files.
|
||||
-- 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/
|
||||
>=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
|
||||
<
|
||||
2017-01-01 groceries
|
||||
|
||||
Loading…
Reference in New Issue
Block a user