cli,ui,web: a @FILE argument reads flags & args from FILE, one per line

This commit is contained in:
Simon Michael 2017-09-30 06:29:57 -10:00
parent beb2f5cc8e
commit e5f794d2cb
11 changed files with 463 additions and 436 deletions

View File

@ -155,6 +155,18 @@ m4_define({{_reportingoptions_}}, {{
: convert amounts to their market value on the report end date
(using the most recent applicable [market price](journal.html#market-prices), if any)
}} )m4_dnl
m4_dnl
m4_define({{_optionnotes_}}, {{
A @FILE argument will be expanded to the contents of FILE,
which should contain one command line option/argument per line.
When multiple similar reporting options are provided, the last one takes precedence.
Eg `--depth 3 --depth 1` is equivalent to `--depth 1`.
Some of the reporting options can also be written as [query arguments](#queries).
}} )m4_dnl
m4_dnl
m4_define({{_generaloptions_}}, {{
@ -165,6 +177,8 @@ _reportingoptions_
_helpoptions_
_optionnotes_
}} )m4_dnl
m4_dnl
m4_define({{_hledgerdescription_}}, {{

View File

@ -99,7 +99,7 @@ checkUIOpts opts =
getHledgerUIOpts :: IO UIOpts
--getHledgerUIOpts = processArgs uimode >>= return . decodeRawOpts >>= rawOptsToUIOpts
getHledgerUIOpts = do
args <- getArgs
args <- getArgs >>= expandArgsAt
let args' = replaceNumericFlags args
let cmdargopts = either usageError id $ process uimode args'
rawOptsToUIOpts $ decodeRawOpts cmdargopts

View File

@ -81,6 +81,8 @@ hledger help options:
_helpoptions_
_optionnotes_
# KEYS
`?` shows a help dialog listing all keys.

View File

@ -95,7 +95,7 @@ checkWebOpts wopts =
getHledgerWebOpts :: IO WebOpts
--getHledgerWebOpts = processArgs webmode >>= return . decodeRawOpts >>= rawOptsToWebOpts
getHledgerWebOpts = do
args <- getArgs
args <- getArgs >>= expandArgsAt
let args' = replaceNumericFlags args
let cmdargopts = either usageError id $ process webmode args'
rawOptsToWebOpts $ decodeRawOpts cmdargopts

View File

@ -136,6 +136,8 @@ hledger help options:
_helpoptions_
_optionnotes_
_man_({{
# ENVIRONMENT

View File

@ -453,7 +453,7 @@ checkCliOpts opts =
--
getHledgerCliOpts :: Mode RawOpts -> IO CliOpts
getHledgerCliOpts mode' = do
args' <- getArgs
args' <- getArgs >>= expandArgsAt
let rawopts = either usageError decodeRawOpts $ process mode' args'
opts <- rawOptsToCliOpts rawopts
debugArgs args' opts

View File

@ -106,7 +106,7 @@ main = do
-- command-line.test.
-- some preliminary (imperfect) argument parsing to supplement cmdargs
args <- getArgs
args <- getArgs >>= expandArgsAt
let
args' = moveFlagsAfterCommand $ replaceNumericFlags args
isFlag = ("-" `isPrefixOf`)

View File

@ -299,11 +299,15 @@ most recent applicable market price, if any)
.RS
.RE
.PP
Note when multiple similar reporting options are provided, the last one
takes precedence.
Eg \f[C]\-p\ feb\ \-p\ mar\f[] is equivalent to \f[C]\-p\ mar\f[].
A \@FILE argument will be expanded to the contents of FILE, which should
contain one command line option/argument per line.
.PP
Some of these can also be written as queries.
When multiple similar reporting options are provided, the last one takes
precedence.
Eg \f[C]\-\-depth\ 3\ \-\-depth\ 1\f[] is equivalent to
\f[C]\-\-depth\ 1\f[].
.PP
Some of the reporting options can also be written as query arguments.
.SS Command options
.PP
To see options for a particular command, including command\-specific

View File

@ -232,10 +232,14 @@ different, like git.)
convert amounts to their market value on the report end date (using
the most recent applicable market price, if any)
Note when multiple similar reporting options are provided, the last
one takes precedence. Eg '-p feb -p mar' is equivalent to '-p mar'.
A @FILE argument will be expanded to the contents of FILE, which
should contain one command line option/argument per line.
Some of these can also be written as queries.
When multiple similar reporting options are provided, the last one
takes precedence. Eg '--depth 3 --depth 1' is equivalent to '--depth
1'.
Some of the reporting options can also be written as query arguments.

File: hledger.1.info, Node: Command options, Next: Command arguments, Prev: General options, Up: OPTIONS
@ -2199,125 +2203,125 @@ Node: OPTIONS3640
Ref: #options3744
Node: General options4025
Ref: #general-options4152
Node: Command options6538
Ref: #command-options6691
Node: Command arguments7089
Ref: #command-arguments7249
Node: Special characters7370
Ref: #special-characters7528
Node: Input files8696
Ref: #input-files8834
Node: Smart dates10797
Ref: #smart-dates10940
Node: Report start & end date11919
Ref: #report-start-end-date12091
Node: Report intervals13157
Ref: #report-intervals13322
Node: Period expressions13723
Ref: #period-expressions13883
Node: Depth limiting16223
Ref: #depth-limiting16369
Node: Pivoting16711
Ref: #pivoting16831
Node: Cost18507
Ref: #cost18617
Node: Market value18735
Ref: #market-value18872
Node: Regular expressions20172
Ref: #regular-expressions20310
Node: QUERIES21671
Ref: #queries21775
Node: COMMANDS25742
Ref: #commands25856
Node: accounts26839
Ref: #accounts26939
Node: activity27932
Ref: #activity28044
Node: add28403
Ref: #add28504
Node: balance31162
Ref: #balance31275
Node: Flat mode34432
Ref: #flat-mode34559
Node: Depth limited balance reports34979
Ref: #depth-limited-balance-reports35182
Node: Multicolumn balance reports35602
Ref: #multicolumn-balance-reports35813
Node: Custom balance output40461
Ref: #custom-balance-output40645
Node: Colour support42738
Ref: #colour-support42899
Node: Output destination43072
Ref: #output-destination43230
Node: CSV output43500
Ref: #csv-output43619
Node: balancesheet44016
Ref: #balancesheet44154
Node: balancesheetequity46122
Ref: #balancesheetequity46273
Node: cashflow47062
Ref: #cashflow47192
Node: check-dates49104
Ref: #check-dates49233
Node: check-dupes49350
Ref: #check-dupes49477
Node: equity49614
Ref: #equity49726
Node: help49889
Ref: #help49992
Node: import51066
Ref: #import51182
Node: incomestatement51577
Ref: #incomestatement51713
Node: prices53666
Ref: #prices53783
Node: print53826
Ref: #print53938
Node: print-unique58784
Ref: #print-unique58912
Node: register58980
Ref: #register59109
Node: Custom register output63610
Ref: #custom-register-output63741
Node: register-match65038
Ref: #register-match65174
Node: rewrite65357
Ref: #rewrite65476
Node: stats65545
Ref: #stats65650
Node: tags66531
Ref: #tags66631
Node: test66663
Ref: #test66749
Node: ADD-ON COMMANDS67117
Ref: #add-on-commands67229
Node: Official add-ons68516
Ref: #official-add-ons68658
Node: api68745
Ref: #api68836
Node: ui68888
Ref: #ui68989
Node: web69047
Ref: #web69138
Node: Third party add-ons69184
Ref: #third-party-add-ons69361
Node: diff69496
Ref: #diff69595
Node: iadd69694
Ref: #iadd69810
Node: interest69893
Ref: #interest70016
Node: irr70111
Ref: #irr70211
Node: Experimental add-ons70289
Ref: #experimental-add-ons70443
Node: autosync70734
Ref: #autosync70848
Node: budget71087
Ref: #budget71211
Node: chart71277
Ref: #chart71396
Node: check71467
Ref: #check71571
Node: Command options6693
Ref: #command-options6846
Node: Command arguments7244
Ref: #command-arguments7404
Node: Special characters7525
Ref: #special-characters7683
Node: Input files8851
Ref: #input-files8989
Node: Smart dates10952
Ref: #smart-dates11095
Node: Report start & end date12074
Ref: #report-start-end-date12246
Node: Report intervals13312
Ref: #report-intervals13477
Node: Period expressions13878
Ref: #period-expressions14038
Node: Depth limiting16378
Ref: #depth-limiting16524
Node: Pivoting16866
Ref: #pivoting16986
Node: Cost18662
Ref: #cost18772
Node: Market value18890
Ref: #market-value19027
Node: Regular expressions20327
Ref: #regular-expressions20465
Node: QUERIES21826
Ref: #queries21930
Node: COMMANDS25897
Ref: #commands26011
Node: accounts26994
Ref: #accounts27094
Node: activity28087
Ref: #activity28199
Node: add28558
Ref: #add28659
Node: balance31317
Ref: #balance31430
Node: Flat mode34587
Ref: #flat-mode34714
Node: Depth limited balance reports35134
Ref: #depth-limited-balance-reports35337
Node: Multicolumn balance reports35757
Ref: #multicolumn-balance-reports35968
Node: Custom balance output40616
Ref: #custom-balance-output40800
Node: Colour support42893
Ref: #colour-support43054
Node: Output destination43227
Ref: #output-destination43385
Node: CSV output43655
Ref: #csv-output43774
Node: balancesheet44171
Ref: #balancesheet44309
Node: balancesheetequity46277
Ref: #balancesheetequity46428
Node: cashflow47217
Ref: #cashflow47347
Node: check-dates49259
Ref: #check-dates49388
Node: check-dupes49505
Ref: #check-dupes49632
Node: equity49769
Ref: #equity49881
Node: help50044
Ref: #help50147
Node: import51221
Ref: #import51337
Node: incomestatement51732
Ref: #incomestatement51868
Node: prices53821
Ref: #prices53938
Node: print53981
Ref: #print54093
Node: print-unique58939
Ref: #print-unique59067
Node: register59135
Ref: #register59264
Node: Custom register output63765
Ref: #custom-register-output63896
Node: register-match65193
Ref: #register-match65329
Node: rewrite65512
Ref: #rewrite65631
Node: stats65700
Ref: #stats65805
Node: tags66686
Ref: #tags66786
Node: test66818
Ref: #test66904
Node: ADD-ON COMMANDS67272
Ref: #add-on-commands67384
Node: Official add-ons68671
Ref: #official-add-ons68813
Node: api68900
Ref: #api68991
Node: ui69043
Ref: #ui69144
Node: web69202
Ref: #web69293
Node: Third party add-ons69339
Ref: #third-party-add-ons69516
Node: diff69651
Ref: #diff69750
Node: iadd69849
Ref: #iadd69965
Node: interest70048
Ref: #interest70171
Node: irr70266
Ref: #irr70366
Node: Experimental add-ons70444
Ref: #experimental-add-ons70598
Node: autosync70889
Ref: #autosync71003
Node: budget71242
Ref: #budget71366
Node: chart71432
Ref: #chart71551
Node: check71622
Ref: #check71726

End Tag Table

View File

@ -203,10 +203,13 @@ OPTIONS
convert amounts to their market value on the report end date
(using the most recent applicable market price, if any)
Note when multiple similar reporting options are provided, the last one
takes precedence. Eg -p feb -p mar is equivalent to -p mar.
A @FILE argument will be expanded to the contents of FILE, which should
contain one command line option/argument per line.
Some of these can also be written as queries.
When multiple similar reporting options are provided, the last one
takes precedence. Eg --depth 3 --depth 1 is equivalent to --depth 1.
Some of the reporting options can also be written as query arguments.
Command options
To see options for a particular command, including command-specific
@ -402,6 +405,7 @@ OPTIONS
earliest or latest transaction in your journal:
-p "from 2009/1/1" everything after january
1, 2009
-p "from 2009/1" the same

View File

@ -18,10 +18,7 @@ General reporting options:
_reportingoptions_
Note when multiple similar reporting options are provided, the last one takes precedence.
Eg `-p feb -p mar` is equivalent to `-p mar`.
Some of these can also be written as [queries](#queries).
_optionnotes_
## Command options