import: create the journal if missing, like the add command
Streamlines import/migration instructions.
This commit is contained in:
parent
568cb32677
commit
dfc0095fed
@ -171,12 +171,11 @@ main = do
|
|||||||
|
|
||||||
-- builtin commands
|
-- builtin commands
|
||||||
| Just (cmdmode, cmdaction) <- findCommand cmd =
|
| Just (cmdmode, cmdaction) <- findCommand cmd =
|
||||||
(case cmd of
|
(case True of
|
||||||
-- these commands should not require or read the journal
|
-- these commands should not require or read the journal
|
||||||
"test" -> cmdaction opts journallesserror
|
_ | cmd `elem` ["test","help"] -> cmdaction opts journallesserror
|
||||||
"help" -> cmdaction opts journallesserror
|
-- these commands should create the journal if missing
|
||||||
-- this command should create the journal if missing
|
_ | cmd `elem` ["add","import"] -> do
|
||||||
"add" -> do
|
|
||||||
(ensureJournalFileExists =<< (head <$> journalFilePathFromOpts opts))
|
(ensureJournalFileExists =<< (head <$> journalFilePathFromOpts opts))
|
||||||
withJournalDo opts (cmdaction opts)
|
withJournalDo opts (cmdaction opts)
|
||||||
-- other commands read the journal and should fail if it's missing
|
-- other commands read the journal and should fail if it's missing
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user