run: allow "run" to invoke "run" (fixes #2331)
This commit is contained in:
parent
88a4b0abae
commit
5bd9be2189
@ -101,12 +101,14 @@ runCommand findBuiltinCommand cmdline = do
|
|||||||
case findBuiltinCommand cmdname of
|
case findBuiltinCommand cmdname of
|
||||||
Nothing -> putStrLn $ unwords (cmdname:args)
|
Nothing -> putStrLn $ unwords (cmdname:args)
|
||||||
Just (cmdmode,cmdaction) -> do
|
Just (cmdmode,cmdaction) -> do
|
||||||
|
-- Allow "run" to call "run"
|
||||||
|
let cmdaction' = if cmdname == "run" then run findBuiltinCommand else cmdaction
|
||||||
-- Normally expandArgsAt is done by the Cli.hs, but it stops at the first '--', so we need
|
-- Normally expandArgsAt is done by the Cli.hs, but it stops at the first '--', so we need
|
||||||
-- to do it here as well to make sure that each command can use @ARGFILEs
|
-- to do it here as well to make sure that each command can use @ARGFILEs
|
||||||
args' <- expandArgsAt args
|
args' <- expandArgsAt args
|
||||||
dbg1IO "runCommand final args" (cmdname,args')
|
dbg1IO "runCommand final args" (cmdname,args')
|
||||||
opts <- getHledgerCliOpts' cmdmode args'
|
opts <- getHledgerCliOpts' cmdmode args'
|
||||||
withJournalCached opts (cmdaction opts)
|
withJournalCached opts (cmdaction' opts)
|
||||||
[] -> return ()
|
[] -> return ()
|
||||||
|
|
||||||
runREPL :: (String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ())) -> IO ()
|
runREPL :: (String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ())) -> IO ()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user