cli: add -t/-l short flags for --tree/--flat; improve help (#1286)
This commit is contained in:
		
							parent
							
								
									ba49699728
								
							
						
					
					
						commit
						3636875a5d
					
				| @ -201,11 +201,15 @@ reportflags = [ | |||||||
|      ]) |      ]) | ||||||
|  ] |  ] | ||||||
| 
 | 
 | ||||||
| -- | Flags for selecting flat/tree mode, used in accounts/balance reports. | -- | Flags for selecting flat/tree mode, used for reports organised by account. | ||||||
| flattreeflags :: [Flag RawOpts] | -- With a True argument, shows some extra help about inclusive/exclusive amounts. | ||||||
| flattreeflags = [ | flattreeflags :: Bool -> [Flag RawOpts] | ||||||
|    flagNone ["flat"] (setboolopt "flat") "show accounts as a list; amounts exclude subaccounts, except where account is depth-clipped" | flattreeflags showamounthelp = [ | ||||||
|   ,flagNone ["tree"] (setboolopt "tree") "show accounts as a tree; amounts include subaccounts" |    flagNone ["flat","l"] (setboolopt "flat") | ||||||
|  |      ("show accounts as a flat list (default)" | ||||||
|  |       ++ if showamounthelp then ". Amounts exclude subaccount amounts, except where the account is depth-clipped." else "") | ||||||
|  |   ,flagNone ["tree","t"] (setboolopt "tree") | ||||||
|  |     ("show accounts as a hierarchic tree" ++ if showamounthelp then ". Amounts include subaccount amounts." else "") | ||||||
|   ] |   ] | ||||||
| 
 | 
 | ||||||
| -- | Common flags that are accepted but not shown in --help, | -- | Common flags that are accepted but not shown in --help, | ||||||
|  | |||||||
| @ -36,12 +36,12 @@ import Hledger.Cli.CliOptions | |||||||
| -- | Command line options for this command. | -- | Command line options for this command. | ||||||
| accountsmode = hledgerCommandMode | accountsmode = hledgerCommandMode | ||||||
|   $(embedFileRelative "Hledger/Cli/Commands/Accounts.txt") |   $(embedFileRelative "Hledger/Cli/Commands/Accounts.txt") | ||||||
|   [flagNone ["declared"] (setboolopt "declared") "show account names declared with account directives" |   ([flagNone ["declared"] (setboolopt "declared") "show account names declared with account directives" | ||||||
|   ,flagNone ["used"] (setboolopt "used") "show account names referenced by transactions" |   ,flagNone ["used"] (setboolopt "used") "show account names referenced by transactions" | ||||||
|   ,flagNone ["flat"] (setboolopt "flat") "show full account names, as a list (default)" |  | ||||||
|   ,flagNone ["tree"] (setboolopt "tree") "show short account names, as a tree" |  | ||||||
|   ,flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts" |  | ||||||
|   ] |   ] | ||||||
|  |   ++ flattreeflags False ++ | ||||||
|  |   [flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts" | ||||||
|  |   ]) | ||||||
|   [generalflagsgroup1] |   [generalflagsgroup1] | ||||||
|   hiddenflags |   hiddenflags | ||||||
|   ([], Just $ argsFlag "[QUERY]") |   ([], Just $ argsFlag "[QUERY]") | ||||||
|  | |||||||
| @ -280,7 +280,7 @@ balancemode = hledgerCommandMode | |||||||
|    ,flagNone ["historical","H"] (setboolopt "historical") |    ,flagNone ["historical","H"] (setboolopt "historical") | ||||||
|       "show historical ending balance in each period (includes postings before report start date)\n " |       "show historical ending balance in each period (includes postings before report start date)\n " | ||||||
|    ] |    ] | ||||||
|    ++ flattreeflags ++ |    ++ flattreeflags True ++ | ||||||
|    [flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts (in flat mode)" |    [flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts (in flat mode)" | ||||||
|    ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)" |    ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)" | ||||||
|    ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)" |    ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)" | ||||||
|  | |||||||
| @ -65,7 +65,7 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = | |||||||
|            ++ defType HistoricalBalance |            ++ defType HistoricalBalance | ||||||
|        ) |        ) | ||||||
|     ] |     ] | ||||||
|     ++ flattreeflags ++ |     ++ flattreeflags True ++ | ||||||
|     [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" | ||||||
|     ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)" |     ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)" | ||||||
|     ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)" |     ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)" | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user