cli: with a repeated flag, the last takes precedence
This is helpful eg for customising your reporting command aliases on the fly.
This commit is contained in:
		
							parent
							
								
									bd39e5df99
								
							
						
					
					
						commit
						d352bbedd2
					
				| @ -46,10 +46,14 @@ in your home directory. You can specify a different file with the `-f` | |||||||
| option or `LEDGER_FILE` environment variable, or standard input with `-f-`. | option or `LEDGER_FILE` environment variable, or standard input with `-f-`. | ||||||
| 
 | 
 | ||||||
| Options are similar across most commands, with some variations; use | Options are similar across most commands, with some variations; use | ||||||
| `hledger COMMAND --help` for details. Most options must appear | `hledger COMMAND --help` for details. | ||||||
| somewhere after COMMAND, not before it. These input and help-related | 
 | ||||||
| options can appear anywhere: `-f`, `--rules-file`, `--alias`, | Most options must appear after COMMAND, not before it; but the | ||||||
| `--ignore-assertions`, `--help`, `--debug`, `--version`. | following general options can appear anywhere: `-f`, `--rules-file`, | ||||||
|  | `--alias`, `--ignore-assertions`, `--help`, `--debug`, `--version`. | ||||||
|  | 
 | ||||||
|  | If an option is repeated, the last one takes precedence. Eg `-p jan -p | ||||||
|  | feb` is equivalent to `-p feb`. | ||||||
| 
 | 
 | ||||||
| Arguments are also command-specific, but usually they form a | Arguments are also command-specific, but usually they form a | ||||||
| [query](#queries) which selects a subset of the journal, eg transactions | [query](#queries) which selects a subset of the journal, eg transactions | ||||||
|  | |||||||
| @ -45,7 +45,7 @@ boolopt :: String -> RawOpts -> Bool | |||||||
| boolopt = inRawOpts | boolopt = inRawOpts | ||||||
| 
 | 
 | ||||||
| maybestringopt :: String -> RawOpts -> Maybe String | maybestringopt :: String -> RawOpts -> Maybe String | ||||||
| maybestringopt name = maybe Nothing (Just . stripquotes) . lookup name | maybestringopt name = maybe Nothing (Just . stripquotes) . lookup name . reverse | ||||||
| 
 | 
 | ||||||
| stringopt :: String -> RawOpts -> String | stringopt :: String -> RawOpts -> String | ||||||
| stringopt name = fromMaybe "" . maybestringopt name | stringopt name = fromMaybe "" . maybestringopt name | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user