acc: integrate CLI help & manual
This commit is contained in:
parent
d1411fbd8d
commit
f68309b106
@ -13,6 +13,7 @@ The @accounts@ command lists account names:
|
||||
{-# LANGUAGE MultiWayIf #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE CPP #-}
|
||||
|
||||
module Hledger.Cli.Commands.Accounts (
|
||||
@ -33,31 +34,17 @@ import Hledger.Cli.CliOptions
|
||||
|
||||
|
||||
-- | Command line options for this command.
|
||||
accountsmode = (defCommandMode $ ["accounts"] ++ aliases) {
|
||||
modeHelp = "show account names" `withAliases` aliases
|
||||
,modeHelpSuffix = [
|
||||
"This command lists account names, either declared with account directives"
|
||||
,"(--declared), posted to (--used), or both (default)."
|
||||
,"With query arguments, only matched account names and account names"
|
||||
,"referenced by matched postings are shown."
|
||||
,"It shows a flat list by default. With `--tree`, it uses indentation to"
|
||||
,"show the account hierarchy."
|
||||
,"In flat mode you can add `--drop N` to omit the first few account name components."
|
||||
,"Account names can be depth-clipped with `--depth N` or depth:N."
|
||||
]
|
||||
,modeGroupFlags = C.Group {
|
||||
groupUnnamed = [
|
||||
flagNone ["declared"] (\opts -> setboolopt "declared" opts) "show account names declared with account directives"
|
||||
accountsmode = hledgerCommandMode
|
||||
$(hereFileRelative "Hledger/Cli/Commands/Accounts.md")
|
||||
[flagNone ["declared"] (\opts -> setboolopt "declared" opts) "show account names declared with account directives"
|
||||
,flagNone ["used"] (\opts -> setboolopt "used" opts) "show account names referenced by transactions"
|
||||
,flagNone ["tree"] (\opts -> setboolopt "tree" opts) "show short account names, as a tree"
|
||||
,flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show full account names, as a list (default)"
|
||||
,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"
|
||||
]
|
||||
,groupHidden = []
|
||||
,groupNamed = [generalflagsgroup1]
|
||||
}
|
||||
}
|
||||
where aliases = ["a"]
|
||||
[generalflagsgroup1]
|
||||
[]
|
||||
([], Just $ argsFlag "[QUERY]")
|
||||
|
||||
-- | The accounts command.
|
||||
accounts :: CliOpts -> Journal -> IO ()
|
||||
|
||||
27
hledger/Hledger/Cli/Commands/Accounts.md
Normal file
27
hledger/Hledger/Cli/Commands/Accounts.md
Normal file
@ -0,0 +1,27 @@
|
||||
accounts, a\
|
||||
Show account names.
|
||||
|
||||
_FLAGS_
|
||||
|
||||
This command lists account names, either declared with account directives
|
||||
(--declared), posted to (--used), or both (the default).
|
||||
With query arguments, only matched account names and account names
|
||||
referenced by matched postings are shown.
|
||||
It shows a flat list by default. With `--tree`, it uses indentation to
|
||||
show the account hierarchy.
|
||||
In flat mode you can add `--drop N` to omit the first few account name components.
|
||||
Account names can be depth-clipped with `depth:N` or `--depth N` or `-N`.
|
||||
|
||||
Examples:
|
||||
|
||||
```shell
|
||||
$ hledger accounts
|
||||
assets:bank:checking
|
||||
assets:bank:saving
|
||||
assets:cash
|
||||
expenses:food
|
||||
expenses:supplies
|
||||
income:gifts
|
||||
income:salary
|
||||
liabilities:debts
|
||||
```
|
||||
@ -23,6 +23,7 @@ It has some special features:
|
||||
- Markdown can be used to influence the appearance of the manuals,
|
||||
especially the html version. But the markup will also appear
|
||||
uninterpreted in the --help output, so use sparingly.
|
||||
m4 macros can not be used.
|
||||
|
||||
- Use only one newline on the first line (or cmdargs will display the
|
||||
short help with two newlines after each line). This also means
|
||||
|
||||
@ -1350,36 +1350,14 @@ See also \f[C]hledger\f[] for a more organised command list, and
|
||||
\f[C]hledger\ CMD\ \-h\f[] for detailed command help.
|
||||
.SS accounts
|
||||
.PP
|
||||
accounts, a
|
||||
.PD 0
|
||||
.P
|
||||
.PD
|
||||
Show account names.
|
||||
Alias: a.
|
||||
.TP
|
||||
.B \f[C]\-\-declared\f[]
|
||||
show account names declared with account directives
|
||||
.RS
|
||||
.RE
|
||||
.TP
|
||||
.B \f[C]\-\-used\f[]
|
||||
show account names posted to by transactions
|
||||
.RS
|
||||
.RE
|
||||
.TP
|
||||
.B \f[C]\-\-tree\f[]
|
||||
show short account names and their parents, as a tree
|
||||
.RS
|
||||
.RE
|
||||
.TP
|
||||
.B \f[C]\-\-flat\f[]
|
||||
show full account names, as a list (default)
|
||||
.RS
|
||||
.RE
|
||||
.TP
|
||||
.B \f[C]\-\-drop=N\f[]
|
||||
in flat mode: omit N leading account name parts
|
||||
.RS
|
||||
.RE
|
||||
.PP
|
||||
This command lists account names, either declared with account
|
||||
directives (\-\-declared), posted to (\-\-used), or both (default).
|
||||
directives (\-\-declared), posted to (\-\-used), or both (the default).
|
||||
With query arguments, only matched account names and account names
|
||||
referenced by matched postings are shown.
|
||||
It shows a flat list by default.
|
||||
@ -1387,46 +1365,13 @@ With \f[C]\-\-tree\f[], it uses indentation to show the account
|
||||
hierarchy.
|
||||
In flat mode you can add \f[C]\-\-drop\ N\f[] to omit the first few
|
||||
account name components.
|
||||
Account names can be depth\-clipped with \f[C]\-\-depth\ N\f[] or
|
||||
depth:N.
|
||||
Account names can be depth\-clipped with \f[C]depth:N\f[] or
|
||||
\f[C]\-\-depth\ N\f[] or \f[C]\-N\f[].
|
||||
.PP
|
||||
Examples:
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
$\ hledger\ accounts\ \-\-tree
|
||||
assets
|
||||
\ \ bank
|
||||
\ \ \ \ checking
|
||||
\ \ \ \ saving
|
||||
\ \ cash
|
||||
expenses
|
||||
\ \ food
|
||||
\ \ supplies
|
||||
income
|
||||
\ \ gifts
|
||||
\ \ salary
|
||||
liabilities
|
||||
\ \ debts
|
||||
\f[]
|
||||
.fi
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
$\ hledger\ accounts\ \-\-drop\ 1
|
||||
bank:checking
|
||||
bank:saving
|
||||
cash
|
||||
food
|
||||
supplies
|
||||
gifts
|
||||
salary
|
||||
debts
|
||||
\f[]
|
||||
.fi
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
$\ hledger\ accounts
|
||||
assets:bank:checking
|
||||
assets:bank:saving
|
||||
|
||||
@ -1020,60 +1020,20 @@ File: hledger.info, Node: accounts, Next: activity, Up: COMMANDS
|
||||
4.1 accounts
|
||||
============
|
||||
|
||||
Show account names. Alias: a.
|
||||
|
||||
'--declared'
|
||||
|
||||
show account names declared with account directives
|
||||
'--used'
|
||||
|
||||
show account names posted to by transactions
|
||||
'--tree'
|
||||
|
||||
show short account names and their parents, as a tree
|
||||
'--flat'
|
||||
|
||||
show full account names, as a list (default)
|
||||
'--drop=N'
|
||||
|
||||
in flat mode: omit N leading account name parts
|
||||
accounts, a
|
||||
Show account names.
|
||||
|
||||
This command lists account names, either declared with account
|
||||
directives (-declared), posted to (-used), or both (default). With
|
||||
directives (-declared), posted to (-used), or both (the default). With
|
||||
query arguments, only matched account names and account names referenced
|
||||
by matched postings are shown. It shows a flat list by default. With
|
||||
'--tree', it uses indentation to show the account hierarchy. In flat
|
||||
mode you can add '--drop N' to omit the first few account name
|
||||
components. Account names can be depth-clipped with '--depth N' or
|
||||
depth:N.
|
||||
components. Account names can be depth-clipped with 'depth:N' or
|
||||
'--depth N' or '-N'.
|
||||
|
||||
Examples:
|
||||
|
||||
$ hledger accounts --tree
|
||||
assets
|
||||
bank
|
||||
checking
|
||||
saving
|
||||
cash
|
||||
expenses
|
||||
food
|
||||
supplies
|
||||
income
|
||||
gifts
|
||||
salary
|
||||
liabilities
|
||||
debts
|
||||
|
||||
$ hledger accounts --drop 1
|
||||
bank:checking
|
||||
bank:saving
|
||||
cash
|
||||
food
|
||||
supplies
|
||||
gifts
|
||||
salary
|
||||
debts
|
||||
|
||||
$ hledger accounts
|
||||
assets:bank:checking
|
||||
assets:bank:saving
|
||||
@ -1970,7 +1930,6 @@ File: hledger.info, Node: close, Next: files, Prev: check-dupes, Up: COMMAND
|
||||
==========
|
||||
|
||||
close, equity
|
||||
|
||||
Prints a "closing balances" transaction and an "opening balances"
|
||||
transaction that bring account balances to and from zero, respectively.
|
||||
Useful for bringing asset/liability balances forward into a new journal
|
||||
@ -2802,98 +2761,98 @@ Node: COMMANDS32539
|
||||
Ref: #commands32651
|
||||
Node: accounts33651
|
||||
Ref: #accounts33749
|
||||
Node: activity34995
|
||||
Ref: #activity35105
|
||||
Node: add35465
|
||||
Ref: #add35564
|
||||
Node: balance38225
|
||||
Ref: #balance38336
|
||||
Node: Classic balance report41456
|
||||
Ref: #classic-balance-report41629
|
||||
Node: Customising the classic balance report42998
|
||||
Ref: #customising-the-classic-balance-report43226
|
||||
Node: Colour support45300
|
||||
Ref: #colour-support45467
|
||||
Node: Flat mode45640
|
||||
Ref: #flat-mode45788
|
||||
Node: Depth limited balance reports46201
|
||||
Ref: #depth-limited-balance-reports46401
|
||||
Node: Multicolumn balance report46857
|
||||
Ref: #multicolumn-balance-report47055
|
||||
Node: Budget report52295
|
||||
Ref: #budget-report52438
|
||||
Node: Nested budgets57122
|
||||
Ref: #nested-budgets57234
|
||||
Ref: #output-format-160714
|
||||
Node: balancesheet60792
|
||||
Ref: #balancesheet60928
|
||||
Node: balancesheetequity63239
|
||||
Ref: #balancesheetequity63388
|
||||
Node: cashflow63925
|
||||
Ref: #cashflow64053
|
||||
Node: check-dates66176
|
||||
Ref: #check-dates66303
|
||||
Node: check-dupes66420
|
||||
Ref: #check-dupes66544
|
||||
Node: close66681
|
||||
Ref: #close66789
|
||||
Node: files70206
|
||||
Ref: #files70307
|
||||
Node: help70448
|
||||
Ref: #help70548
|
||||
Node: import71622
|
||||
Ref: #import71736
|
||||
Node: incomestatement72466
|
||||
Ref: #incomestatement72600
|
||||
Node: prices75004
|
||||
Ref: #prices75119
|
||||
Node: print75391
|
||||
Ref: #print75501
|
||||
Node: print-unique80395
|
||||
Ref: #print-unique80521
|
||||
Node: register80589
|
||||
Ref: #register80716
|
||||
Node: Custom register output85217
|
||||
Ref: #custom-register-output85346
|
||||
Node: register-match86576
|
||||
Ref: #register-match86710
|
||||
Node: rewrite86893
|
||||
Ref: #rewrite87008
|
||||
Node: roi87077
|
||||
Ref: #roi87175
|
||||
Node: stats87291
|
||||
Ref: #stats87390
|
||||
Node: tags88260
|
||||
Ref: #tags88358
|
||||
Node: test88594
|
||||
Ref: #test88678
|
||||
Node: ADD-ON COMMANDS89386
|
||||
Ref: #add-on-commands89496
|
||||
Node: Official add-ons90783
|
||||
Ref: #official-add-ons90923
|
||||
Node: api91010
|
||||
Ref: #api91099
|
||||
Node: ui91151
|
||||
Ref: #ui91250
|
||||
Node: web91308
|
||||
Ref: #web91397
|
||||
Node: Third party add-ons91443
|
||||
Ref: #third-party-add-ons91618
|
||||
Node: diff91753
|
||||
Ref: #diff91850
|
||||
Node: iadd91949
|
||||
Ref: #iadd92063
|
||||
Node: interest92146
|
||||
Ref: #interest92267
|
||||
Node: irr92362
|
||||
Ref: #irr92460
|
||||
Node: Experimental add-ons92591
|
||||
Ref: #experimental-add-ons92743
|
||||
Node: autosync93023
|
||||
Ref: #autosync93134
|
||||
Node: chart93373
|
||||
Ref: #chart93492
|
||||
Node: check93563
|
||||
Ref: #check93665
|
||||
Node: activity34448
|
||||
Ref: #activity34558
|
||||
Node: add34918
|
||||
Ref: #add35017
|
||||
Node: balance37678
|
||||
Ref: #balance37789
|
||||
Node: Classic balance report40909
|
||||
Ref: #classic-balance-report41082
|
||||
Node: Customising the classic balance report42451
|
||||
Ref: #customising-the-classic-balance-report42679
|
||||
Node: Colour support44753
|
||||
Ref: #colour-support44920
|
||||
Node: Flat mode45093
|
||||
Ref: #flat-mode45241
|
||||
Node: Depth limited balance reports45654
|
||||
Ref: #depth-limited-balance-reports45854
|
||||
Node: Multicolumn balance report46310
|
||||
Ref: #multicolumn-balance-report46508
|
||||
Node: Budget report51748
|
||||
Ref: #budget-report51891
|
||||
Node: Nested budgets56575
|
||||
Ref: #nested-budgets56687
|
||||
Ref: #output-format-160167
|
||||
Node: balancesheet60245
|
||||
Ref: #balancesheet60381
|
||||
Node: balancesheetequity62692
|
||||
Ref: #balancesheetequity62841
|
||||
Node: cashflow63378
|
||||
Ref: #cashflow63506
|
||||
Node: check-dates65629
|
||||
Ref: #check-dates65756
|
||||
Node: check-dupes65873
|
||||
Ref: #check-dupes65997
|
||||
Node: close66134
|
||||
Ref: #close66242
|
||||
Node: files69655
|
||||
Ref: #files69756
|
||||
Node: help69897
|
||||
Ref: #help69997
|
||||
Node: import71071
|
||||
Ref: #import71185
|
||||
Node: incomestatement71915
|
||||
Ref: #incomestatement72049
|
||||
Node: prices74453
|
||||
Ref: #prices74568
|
||||
Node: print74840
|
||||
Ref: #print74950
|
||||
Node: print-unique79844
|
||||
Ref: #print-unique79970
|
||||
Node: register80038
|
||||
Ref: #register80165
|
||||
Node: Custom register output84666
|
||||
Ref: #custom-register-output84795
|
||||
Node: register-match86025
|
||||
Ref: #register-match86159
|
||||
Node: rewrite86342
|
||||
Ref: #rewrite86457
|
||||
Node: roi86526
|
||||
Ref: #roi86624
|
||||
Node: stats86740
|
||||
Ref: #stats86839
|
||||
Node: tags87709
|
||||
Ref: #tags87807
|
||||
Node: test88043
|
||||
Ref: #test88127
|
||||
Node: ADD-ON COMMANDS88835
|
||||
Ref: #add-on-commands88945
|
||||
Node: Official add-ons90232
|
||||
Ref: #official-add-ons90372
|
||||
Node: api90459
|
||||
Ref: #api90548
|
||||
Node: ui90600
|
||||
Ref: #ui90699
|
||||
Node: web90757
|
||||
Ref: #web90846
|
||||
Node: Third party add-ons90892
|
||||
Ref: #third-party-add-ons91067
|
||||
Node: diff91202
|
||||
Ref: #diff91299
|
||||
Node: iadd91398
|
||||
Ref: #iadd91512
|
||||
Node: interest91595
|
||||
Ref: #interest91716
|
||||
Node: irr91811
|
||||
Ref: #irr91909
|
||||
Node: Experimental add-ons92040
|
||||
Ref: #experimental-add-ons92192
|
||||
Node: autosync92472
|
||||
Ref: #autosync92583
|
||||
Node: chart92822
|
||||
Ref: #chart92941
|
||||
Node: check93012
|
||||
Ref: #check93114
|
||||
|
||||
End Tag Table
|
||||
|
||||
@ -903,55 +903,20 @@ COMMANDS
|
||||
detailed command help.
|
||||
|
||||
accounts
|
||||
Show account names. Alias: a.
|
||||
|
||||
--declared
|
||||
show account names declared with account directives
|
||||
|
||||
--used show account names posted to by transactions
|
||||
|
||||
--tree show short account names and their parents, as a tree
|
||||
|
||||
--flat show full account names, as a list (default)
|
||||
|
||||
--drop=N
|
||||
in flat mode: omit N leading account name parts
|
||||
accounts, a
|
||||
Show account names.
|
||||
|
||||
This command lists account names, either declared with account direc-
|
||||
tives (--declared), posted to (--used), or both (default). With query
|
||||
arguments, only matched account names and account names referenced by
|
||||
matched postings are shown. It shows a flat list by default. With
|
||||
--tree, it uses indentation to show the account hierarchy. In flat
|
||||
mode you can add --drop N to omit the first few account name compo-
|
||||
nents. Account names can be depth-clipped with --depth N or depth:N.
|
||||
tives (--declared), posted to (--used), or both (the default). With
|
||||
query arguments, only matched account names and account names refer-
|
||||
enced by matched postings are shown. It shows a flat list by default.
|
||||
With --tree, it uses indentation to show the account hierarchy. In
|
||||
flat mode you can add --drop N to omit the first few account name com-
|
||||
ponents. Account names can be depth-clipped with depth:N or --depth N
|
||||
or -N.
|
||||
|
||||
Examples:
|
||||
|
||||
$ hledger accounts --tree
|
||||
assets
|
||||
bank
|
||||
checking
|
||||
saving
|
||||
cash
|
||||
expenses
|
||||
food
|
||||
supplies
|
||||
income
|
||||
gifts
|
||||
salary
|
||||
liabilities
|
||||
debts
|
||||
|
||||
$ hledger accounts --drop 1
|
||||
bank:checking
|
||||
bank:saving
|
||||
cash
|
||||
food
|
||||
supplies
|
||||
gifts
|
||||
salary
|
||||
debts
|
||||
|
||||
$ hledger accounts
|
||||
assets:bank:checking
|
||||
assets:bank:saving
|
||||
|
||||
@ -24,76 +24,8 @@ for each command: name, synopsis, description, examples.
|
||||
-->
|
||||
|
||||
## accounts
|
||||
Show account names. Alias: a.
|
||||
|
||||
`--declared`
|
||||
: show account names declared with account directives
|
||||
|
||||
`--used`
|
||||
: show account names posted to by transactions
|
||||
|
||||
`--tree`
|
||||
: show short account names and their parents, as a tree
|
||||
|
||||
`--flat`
|
||||
: show full account names, as a list (default)
|
||||
|
||||
`--drop=N`
|
||||
: in flat mode: omit N leading account name parts
|
||||
|
||||
This command lists account names, either declared with account directives
|
||||
(--declared), posted to (--used), or both (default).
|
||||
With query arguments, only matched account names and account names
|
||||
referenced by matched postings are shown.
|
||||
It shows a flat list by default. With `--tree`, it uses indentation to
|
||||
show the account hierarchy.
|
||||
In flat mode you can add `--drop N` to omit the first few account name components.
|
||||
Account names can be depth-clipped with `--depth N` or depth:N.
|
||||
|
||||
Examples:
|
||||
|
||||
_col3_({{
|
||||
_shell_({{
|
||||
$ hledger accounts --tree
|
||||
assets
|
||||
bank
|
||||
checking
|
||||
saving
|
||||
cash
|
||||
expenses
|
||||
food
|
||||
supplies
|
||||
income
|
||||
gifts
|
||||
salary
|
||||
liabilities
|
||||
debts
|
||||
}})
|
||||
}},{{
|
||||
_shell_({{
|
||||
$ hledger accounts --drop 1
|
||||
bank:checking
|
||||
bank:saving
|
||||
cash
|
||||
food
|
||||
supplies
|
||||
gifts
|
||||
salary
|
||||
debts
|
||||
}})
|
||||
}},{{
|
||||
_shell_({{
|
||||
$ hledger accounts
|
||||
assets:bank:checking
|
||||
assets:bank:saving
|
||||
assets:cash
|
||||
expenses:food
|
||||
expenses:supplies
|
||||
income:gifts
|
||||
income:salary
|
||||
liabilities:debts
|
||||
}})
|
||||
}})
|
||||
_include_(Hledger/Cli/Commands/Accounts.md)
|
||||
|
||||
## activity
|
||||
Show an ascii barchart of posting counts per interval.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user