dev:import: improve buggy detection of import command
This commit is contained in:
parent
c515fedf70
commit
c60ec90756
@ -157,8 +157,10 @@ parse iopts rulesfile h = do
|
|||||||
let
|
let
|
||||||
-- XXX How can we know when the command is import, and if it's a dry run ? In a hacky way, currently.
|
-- XXX How can we know when the command is import, and if it's a dry run ? In a hacky way, currently.
|
||||||
args = progArgs
|
args = progArgs
|
||||||
cmd = headDef "" $ dropWhile ((=="-").take 1) args
|
-- XXX Difficult to identify the command name reliably here,
|
||||||
cmdisimport = dbg7 "cmdisimport" $ cmd `elem` ["import", "imp"]
|
-- Cli.hs's moveFlagsAfterCommand would help but is not importable here.
|
||||||
|
-- Just look for import or imp appearing anywhere in the arguments.
|
||||||
|
cmdisimport = dbg7 "cmdisimport" $ any (`elem` args) ["import", "imp"]
|
||||||
dryrun = dbg7 "dryrun" $ any (`elem` args) ["--dry-run", "--dry"]
|
dryrun = dbg7 "dryrun" $ any (`elem` args) ["--dry-run", "--dry"]
|
||||||
importing = dbg7 "importing" $ cmdisimport && not dryrun
|
importing = dbg7 "importing" $ cmdisimport && not dryrun
|
||||||
archive = dbg7 "archive" $ isJust (getDirective "archive" rules)
|
archive = dbg7 "archive" $ isJust (getDirective "archive" rules)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user