;run: require -- before first command (+test for that)
This commit is contained in:
parent
b031144961
commit
9c63b36d88
@ -89,7 +89,10 @@ run defaultJournalOverride findBuiltinCommand cliopts@CliOpts{rawopts_=rawopts}
|
|||||||
allAreFiles <- and <$> mapM (doesFileExist . snd . splitReaderPrefix) args
|
allAreFiles <- and <$> mapM (doesFileExist . snd . splitReaderPrefix) args
|
||||||
case allAreFiles of
|
case allAreFiles of
|
||||||
True -> runFromFiles key findBuiltinCommand args
|
True -> runFromFiles key findBuiltinCommand args
|
||||||
False -> runFromArgs key findBuiltinCommand args
|
False ->
|
||||||
|
case args of
|
||||||
|
"--":_ -> runFromArgs key findBuiltinCommand args
|
||||||
|
_ -> error' $ "'run' expects '--' before first command, found none"
|
||||||
|
|
||||||
-- | The actual repl command.
|
-- | The actual repl command.
|
||||||
repl :: (String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ())) -> CliOpts -> IO ()
|
repl :: (String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ())) -> CliOpts -> IO ()
|
||||||
|
|||||||
@ -1,5 +1,14 @@
|
|||||||
# * run command
|
# * run command
|
||||||
|
|
||||||
|
# ** 0. Run requires -- before first command
|
||||||
|
<
|
||||||
|
2017-01-01 groceries
|
||||||
|
assets:cash -$100
|
||||||
|
expenses:food
|
||||||
|
$ hledger run -f- register cash
|
||||||
|
>2 /hledger: Error: 'run' expects '--' before first command, found none/
|
||||||
|
>=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