cli: restore --aux-date and --effective as --date2 aliases (#1034)
These Ledger-ish spellings were dropped over the years, to improve --help's layout. Now they work again, but are considered hidden flags so --help doesn't show them automatically (but I decided to mention them manually in --date2's description).
This commit is contained in:
		
							parent
							
								
									41fecde188
								
							
						
					
					
						commit
						faf85d91e3
					
				| @ -51,7 +51,7 @@ uimode =  (mode "hledger-ui" [("command","ui")] | |||||||
|             (argsFlag "[PATTERNS]") []){ |             (argsFlag "[PATTERNS]") []){ | ||||||
|               modeGroupFlags = Group { |               modeGroupFlags = Group { | ||||||
|                                 groupUnnamed = uiflags |                                 groupUnnamed = uiflags | ||||||
|                                ,groupHidden = [] |                                ,groupHidden = hiddenflags | ||||||
|                                ,groupNamed = [(generalflagsgroup1)] |                                ,groupNamed = [(generalflagsgroup1)] | ||||||
|                                } |                                } | ||||||
|              ,modeHelpSuffix=[ |              ,modeHelpSuffix=[ | ||||||
|  | |||||||
| @ -75,6 +75,7 @@ webmode = | |||||||
|       Group |       Group | ||||||
|       { groupUnnamed = webflags |       { groupUnnamed = webflags | ||||||
|       , groupHidden = |       , groupHidden = | ||||||
|  |           hiddenflags ++ | ||||||
|           [ flagNone |           [ flagNone | ||||||
|               ["binary-filename"] |               ["binary-filename"] | ||||||
|               (setboolopt "binary-filename") |               (setboolopt "binary-filename") | ||||||
|  | |||||||
| @ -12,6 +12,7 @@ module Hledger.Cli.CliOptions ( | |||||||
|   -- * cmdargs flags & modes |   -- * cmdargs flags & modes | ||||||
|   helpflags, |   helpflags, | ||||||
|   detailedversionflag, |   detailedversionflag, | ||||||
|  |   hiddenflags, | ||||||
|   inputflags, |   inputflags, | ||||||
|   reportflags, |   reportflags, | ||||||
|   outputflags, |   outputflags, | ||||||
| @ -112,7 +113,7 @@ helpflags = [ | |||||||
|  ,flagNone ["version"] (setboolopt "version") "show version information" |  ,flagNone ["version"] (setboolopt "version") "show version information" | ||||||
|  ] |  ] | ||||||
| 
 | 
 | ||||||
| -- | A hidden flag, just for the hledger executable. | -- | A hidden flag just for the hledger executable. | ||||||
| detailedversionflag :: Flag RawOpts | detailedversionflag :: Flag RawOpts | ||||||
| detailedversionflag = flagNone ["version+"] (setboolopt "version+") "show version information with extra detail" | detailedversionflag = flagNone ["version+"] (setboolopt "version+") "show version information with extra detail" | ||||||
| 
 | 
 | ||||||
| @ -141,7 +142,7 @@ reportflags = [ | |||||||
|  ,flagNone ["quarterly","Q"] (setboolopt "quarterly") "multiperiod/multicolumn report by quarter" |  ,flagNone ["quarterly","Q"] (setboolopt "quarterly") "multiperiod/multicolumn report by quarter" | ||||||
|  ,flagNone ["yearly","Y"]    (setboolopt "yearly") "multiperiod/multicolumn report by year" |  ,flagNone ["yearly","Y"]    (setboolopt "yearly") "multiperiod/multicolumn report by year" | ||||||
|  ,flagReq  ["period","p"]    (\s opts -> Right $ setopt "period" s opts) "PERIODEXP" "set start date, end date, and/or report interval all at once (overrides the flags above)" |  ,flagReq  ["period","p"]    (\s opts -> Right $ setopt "period" s opts) "PERIODEXP" "set start date, end date, and/or report interval all at once (overrides the flags above)" | ||||||
|  ,flagNone ["date2"]         (setboolopt "date2") "match the secondary date instead (see command help for other effects)" |  ,flagNone ["date2"]         (setboolopt "date2") "match the secondary date instead. See command help for other effects. (--effective, --aux-date also accepted)"  -- see also hiddenflags | ||||||
| 
 | 
 | ||||||
|   -- status/realness/depth/zero filters |   -- status/realness/depth/zero filters | ||||||
|  ,flagNone ["unmarked","U"]  (setboolopt "unmarked") "include only unmarked postings/txns (can combine with -P or -C)" |  ,flagNone ["unmarked","U"]  (setboolopt "unmarked") "include only unmarked postings/txns (can combine with -P or -C)" | ||||||
| @ -184,6 +185,13 @@ reportflags = [ | |||||||
| 
 | 
 | ||||||
|  ] |  ] | ||||||
| 
 | 
 | ||||||
|  | -- | Common flags that are accepted but not shown in --help, | ||||||
|  | -- such as --effective, --aux-date. | ||||||
|  | hiddenflags :: [Flag RawOpts] | ||||||
|  | hiddenflags = [ | ||||||
|  |   flagNone ["effective","aux-date"] (setboolopt "date2") "Ledger-compatible aliases for --date2" | ||||||
|  |  ] | ||||||
|  | 
 | ||||||
| -- | Common output-related flags: --output-file, --output-format... | -- | Common output-related flags: --output-file, --output-format... | ||||||
| outputflags = [outputFormatFlag, outputFileFlag] | outputflags = [outputFormatFlag, outputFileFlag] | ||||||
| outputFormatFlag = flagReq  ["output-format","O"] (\s opts -> Right $ setopt "output-format" s opts) "FMT" "select the output format. Supported formats:\ntxt, csv, html." | outputFormatFlag = flagReq  ["output-format","O"] (\s opts -> Right $ setopt "output-format" s opts) "FMT" "select the output format. Supported formats:\ntxt, csv, html." | ||||||
| @ -262,8 +270,8 @@ addonCommandMode name = (defCommandMode [name]) { | |||||||
|      --  ] |      --  ] | ||||||
|   ,modeGroupFlags = Group { |   ,modeGroupFlags = Group { | ||||||
|       groupUnnamed = [] |       groupUnnamed = [] | ||||||
|      ,groupHidden = [] |      ,groupHidden  = hiddenflags | ||||||
|      ,groupNamed = [generalflagsgroup1] |      ,groupNamed   = [generalflagsgroup1] | ||||||
|      } |      } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -43,7 +43,7 @@ accountsmode = hledgerCommandMode | |||||||
|   ,flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts" |   ,flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts" | ||||||
|   ] |   ] | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[QUERY]") |   ([], Just $ argsFlag "[QUERY]") | ||||||
| 
 | 
 | ||||||
| -- | The accounts command. | -- | The accounts command. | ||||||
|  | |||||||
| @ -22,7 +22,7 @@ activitymode = hledgerCommandMode | |||||||
|   $(embedFileRelative "Hledger/Cli/Commands/Activity.txt") |   $(embedFileRelative "Hledger/Cli/Commands/Activity.txt") | ||||||
|   [] |   [] | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[QUERY]") |   ([], Just $ argsFlag "[QUERY]") | ||||||
| 
 | 
 | ||||||
| barchar :: Char | barchar :: Char | ||||||
|  | |||||||
| @ -296,7 +296,7 @@ balancemode = hledgerCommandMode | |||||||
|    ++ outputflags |    ++ outputflags | ||||||
|   ) |   ) | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[QUERY]") |   ([], Just $ argsFlag "[QUERY]") | ||||||
| 
 | 
 | ||||||
| -- | The balance command, prints a balance report. | -- | The balance command, prints a balance report. | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ checkdatesmode = hledgerCommandMode | |||||||
|   $(embedFileRelative "Hledger/Cli/Commands/Checkdates.txt") |   $(embedFileRelative "Hledger/Cli/Commands/Checkdates.txt") | ||||||
|   [flagNone ["strict"] (setboolopt "strict") "makes date comparing strict"] |   [flagNone ["strict"] (setboolopt "strict") "makes date comparing strict"] | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[QUERY]") |   ([], Just $ argsFlag "[QUERY]") | ||||||
| 
 | 
 | ||||||
| checkdates :: CliOpts -> Journal -> IO () | checkdates :: CliOpts -> Journal -> IO () | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ checkdupesmode = hledgerCommandMode | |||||||
|   $(embedFileRelative "Hledger/Cli/Commands/Checkdupes.txt") |   $(embedFileRelative "Hledger/Cli/Commands/Checkdupes.txt") | ||||||
|   [] |   [] | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Nothing) |   ([], Nothing) | ||||||
| 
 | 
 | ||||||
| checkdupes _opts j = mapM_ render $ checkdupes' $ accountsNames j | checkdupes _opts j = mapM_ render $ checkdupes' $ accountsNames j | ||||||
|  | |||||||
| @ -21,7 +21,7 @@ closemode = hledgerCommandMode | |||||||
|   ,flagNone ["closing"] (setboolopt "closing") "show just closing transaction" |   ,flagNone ["closing"] (setboolopt "closing") "show just closing transaction" | ||||||
|   ] |   ] | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[QUERY]") |   ([], Just $ argsFlag "[QUERY]") | ||||||
| 
 | 
 | ||||||
| close CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do | close CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do | ||||||
|  | |||||||
| @ -20,7 +20,7 @@ importmode = hledgerCommandMode | |||||||
|   $(embedFileRelative "Hledger/Cli/Commands/Import.txt") |   $(embedFileRelative "Hledger/Cli/Commands/Import.txt") | ||||||
|   [flagNone ["dry-run"] (setboolopt "dry-run") "just show the transactions to be imported"]  |   [flagNone ["dry-run"] (setboolopt "dry-run") "just show the transactions to be imported"]  | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "FILE [...]") |   ([], Just $ argsFlag "FILE [...]") | ||||||
| 
 | 
 | ||||||
| importcmd opts@CliOpts{rawopts_=rawopts,inputopts_=iopts} j = do | importcmd opts@CliOpts{rawopts_=rawopts,inputopts_=iopts} j = do | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ pricesmode = hledgerCommandMode | |||||||
|   [flagNone ["costs"] (setboolopt "costs") "print transaction prices from postings" |   [flagNone ["costs"] (setboolopt "costs") "print transaction prices from postings" | ||||||
|   ,flagNone ["inverted-costs"] (setboolopt "inverted-costs") "print transaction inverted prices from postings also"] |   ,flagNone ["inverted-costs"] (setboolopt "inverted-costs") "print transaction inverted prices from postings also"] | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[QUERY]") |   ([], Just $ argsFlag "[QUERY]") | ||||||
| 
 | 
 | ||||||
| -- XXX the original hledger-prices script always ignored assertions  | -- XXX the original hledger-prices script always ignored assertions  | ||||||
|  | |||||||
| @ -37,7 +37,7 @@ printmode = hledgerCommandMode | |||||||
|     "show only newer-dated transactions added in each file since last run" |     "show only newer-dated transactions added in each file since last run" | ||||||
|   ] ++ outputflags) |   ] ++ outputflags) | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[QUERY]") |   ([], Just $ argsFlag "[QUERY]") | ||||||
| 
 | 
 | ||||||
| -- | Print journal transactions in standard format. | -- | Print journal transactions in standard format. | ||||||
|  | |||||||
| @ -15,7 +15,7 @@ printuniquemode = hledgerCommandMode | |||||||
|   $(embedFileRelative "Hledger/Cli/Commands/Printunique.txt") |   $(embedFileRelative "Hledger/Cli/Commands/Printunique.txt") | ||||||
|   [] |   [] | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Nothing) |   ([], Nothing) | ||||||
| 
 | 
 | ||||||
| printunique opts j@Journal{jtxns=ts} = do | printunique opts j@Journal{jtxns=ts} = do | ||||||
|  | |||||||
| @ -50,7 +50,7 @@ registermode = hledgerCommandMode | |||||||
|      ) |      ) | ||||||
|   ] ++ outputflags) |   ] ++ outputflags) | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[QUERY]") |   ([], Just $ argsFlag "[QUERY]") | ||||||
| 
 | 
 | ||||||
| -- | Print a (posting) register report. | -- | Print a (posting) register report. | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ registermatchmode = hledgerCommandMode | |||||||
|   $(embedFileRelative "Hledger/Cli/Commands/Registermatch.txt") |   $(embedFileRelative "Hledger/Cli/Commands/Registermatch.txt") | ||||||
|   [] |   [] | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "DESC") |   ([], Just $ argsFlag "DESC") | ||||||
| 
 | 
 | ||||||
| registermatch :: CliOpts -> Journal -> IO () | registermatch :: CliOpts -> Journal -> IO () | ||||||
|  | |||||||
| @ -29,7 +29,7 @@ rewritemode = hledgerCommandMode | |||||||
|   ,flagNone ["diff"] (setboolopt "diff") "generate diff suitable as an input for patch tool" |   ,flagNone ["diff"] (setboolopt "diff") "generate diff suitable as an input for patch tool" | ||||||
|   ] |   ] | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[QUERY] --add-posting \"ACCT  AMTEXPR\" ...") |   ([], Just $ argsFlag "[QUERY] --add-posting \"ACCT  AMTEXPR\" ...") | ||||||
| 
 | 
 | ||||||
| -- TODO regex matching and interpolating matched name in replacement | -- TODO regex matching and interpolating matched name in replacement | ||||||
|  | |||||||
| @ -37,7 +37,7 @@ roimode = hledgerCommandMode | |||||||
|     "query to select profit-and-loss or appreciation/valuation transactions" |     "query to select profit-and-loss or appreciation/valuation transactions" | ||||||
|   ] |   ] | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[QUERY]") |   ([], Just $ argsFlag "[QUERY]") | ||||||
| 
 | 
 | ||||||
| -- One reporting span,  | -- One reporting span,  | ||||||
|  | |||||||
| @ -35,7 +35,7 @@ statsmode = hledgerCommandMode | |||||||
|   [flagReq  ["output-file","o"]   (\s opts -> Right $ setopt "output-file" s opts) "FILE" "write output to FILE." |   [flagReq  ["output-file","o"]   (\s opts -> Right $ setopt "output-file" s opts) "FILE" "write output to FILE." | ||||||
|   ] |   ] | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[QUERY]") |   ([], Just $ argsFlag "[QUERY]") | ||||||
| 
 | 
 | ||||||
| -- like Register.summarisePostings | -- like Register.summarisePostings | ||||||
|  | |||||||
| @ -17,7 +17,7 @@ tagsmode = hledgerCommandMode | |||||||
|   $(embedFileRelative "Hledger/Cli/Commands/Tags.txt") |   $(embedFileRelative "Hledger/Cli/Commands/Tags.txt") | ||||||
|   [] -- [flagNone ["strict"] (setboolopt "strict") "makes date comparing strict"] --  |   [] -- [flagNone ["strict"] (setboolopt "strict") "makes date comparing strict"] --  | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   [] |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[TAGREGEX [QUERY...]]") |   ([], Just $ argsFlag "[TAGREGEX [QUERY...]]") | ||||||
| 
 | 
 | ||||||
| tags CliOpts{rawopts_=rawopts,reportopts_=ropts} j = do | tags CliOpts{rawopts_=rawopts,reportopts_=ropts} j = do | ||||||
|  | |||||||
| @ -108,7 +108,7 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = | |||||||
|     ,outputFileFlag |     ,outputFileFlag | ||||||
|     ] |     ] | ||||||
|     [generalflagsgroup1] |     [generalflagsgroup1] | ||||||
|     [] |     hiddenflags | ||||||
|     ([], Just $ argsFlag "[QUERY]") |     ([], Just $ argsFlag "[QUERY]") | ||||||
|  where |  where | ||||||
|    defType :: BalanceType -> String |    defType :: BalanceType -> String | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user