imp:cli: clearer help for -f, and the add and import commands
From euouae's irc feedback
This commit is contained in:
parent
03262f3fff
commit
4c1c44ce36
@ -154,7 +154,14 @@ Right binaryinfo = parseHledgerVersion prognameandversion
|
|||||||
-- | Common input-related flags: --file, --rules, --conf, --alias...
|
-- | Common input-related flags: --file, --rules, --conf, --alias...
|
||||||
inputflags :: [Flag RawOpts]
|
inputflags :: [Flag RawOpts]
|
||||||
inputflags = [
|
inputflags = [
|
||||||
flagReq ["file","f"] (\s opts -> Right $ setopt "file" s opts) "[FMT:]FILE" "Read data from FILE, or from stdin if FILE is -, inferring format from extension or a FMT: prefix. Can be specified more than once. If not specified, reads from $LEDGER_FILE or $HOME/.hledger.journal."
|
flagReq ["file","f"] (\s opts -> Right $ setopt "file" s opts) "[FMT:]FILE" $ unwords [
|
||||||
|
"Use this as the journal file (- means stdin)."
|
||||||
|
,"If not specified, $LEDGER_FILE or ~/.hledger.journal will be used."
|
||||||
|
,"If specified more than once, the files will be read in order."
|
||||||
|
,"Each file's format (journal, csv, timeclock, timedot, rules..) is inferred from the file extension or a FMT: prefix."
|
||||||
|
,"Some commands (add, import) write to the (first) file,"
|
||||||
|
,"and expect it to be in journal format."
|
||||||
|
]
|
||||||
,flagReq ["rules"] (\s opts -> Right $ setopt "rules" s opts) "RULESFILE" "Use rules defined in this rules file for converting subsequent CSV/SSV/TSV files. If not specified, uses FILE.csv.rules for each FILE.csv." -- see also hiddenflags
|
,flagReq ["rules"] (\s opts -> Right $ setopt "rules" s opts) "RULESFILE" "Use rules defined in this rules file for converting subsequent CSV/SSV/TSV files. If not specified, uses FILE.csv.rules for each FILE.csv." -- see also hiddenflags
|
||||||
|
|
||||||
,flagReq ["alias"] (\s opts -> Right $ setopt "alias" s opts) "A=B|/RGX/=RPL" "transform account names from A to B, or by replacing regular expression matches"
|
,flagReq ["alias"] (\s opts -> Right $ setopt "alias" s opts) "A=B|/RGX/=RPL" "transform account names from A to B, or by replacing regular expression matches"
|
||||||
|
|||||||
@ -54,7 +54,7 @@ addmode = hledgerCommandMode
|
|||||||
[flagNone ["no-new-accounts"] (setboolopt "no-new-accounts") "don't allow creating new accounts"]
|
[flagNone ["no-new-accounts"] (setboolopt "no-new-accounts") "don't allow creating new accounts"]
|
||||||
[generalflagsgroup2]
|
[generalflagsgroup2]
|
||||||
[]
|
[]
|
||||||
([], Just $ argsFlag "[DATE [DESCRIPTION [ACCOUNT1 [AMOUNT1 [ACCOUNT2 [ETC...]]]]]]")
|
([], Just $ argsFlag "[-f JOURNALFILE] [DATE [DESCRIPTION [ACCOUNT1 [ETC..]]]]]")
|
||||||
|
|
||||||
-- | State used while entering transactions.
|
-- | State used while entering transactions.
|
||||||
data EntryState = EntryState {
|
data EntryState = EntryState {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
## add
|
## add
|
||||||
|
|
||||||
Add new transactions to a journal file, with interactive prompting in the console.
|
Add new transactions to a journal file, with interactive prompting.
|
||||||
|
|
||||||
```flags
|
```flags
|
||||||
Flags:
|
Flags:
|
||||||
|
|||||||
@ -27,7 +27,7 @@ importmode = hledgerCommandMode
|
|||||||
]
|
]
|
||||||
cligeneralflagsgroups1
|
cligeneralflagsgroups1
|
||||||
hiddenflags
|
hiddenflags
|
||||||
([], Just $ argsFlag "FILE [...]")
|
([], Just $ argsFlag "[-f JOURNALFILE] DATAFILES...")
|
||||||
|
|
||||||
importcmd opts@CliOpts{rawopts_=rawopts,inputopts_=iopts} j = do
|
importcmd opts@CliOpts{rawopts_=rawopts,inputopts_=iopts} j = do
|
||||||
-- XXX could be helpful to show the last-seen date, and number of old transactions, too
|
-- XXX could be helpful to show the last-seen date, and number of old transactions, too
|
||||||
@ -53,7 +53,7 @@ importcmd opts@CliOpts{rawopts_=rawopts,inputopts_=iopts} j = do
|
|||||||
}
|
}
|
||||||
|
|
||||||
case inputfiles of
|
case inputfiles of
|
||||||
[] -> error' "please provide one or more input files as arguments" -- PARTIAL:
|
[] -> error' "please provide one or more data files as arguments" -- PARTIAL:
|
||||||
fs -> do
|
fs -> do
|
||||||
enewjandlatestdatesforfiles <- runExceptT $ readJournalFilesAndLatestDates iopts' fs
|
enewjandlatestdatesforfiles <- runExceptT $ readJournalFilesAndLatestDates iopts' fs
|
||||||
case enewjandlatestdatesforfiles of
|
case enewjandlatestdatesforfiles of
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user