bin: name hledger-check-dupes like other validation commands
This commit is contained in:
parent
e2faf08088
commit
abfd6394ee
@ -20,7 +20,7 @@ import qualified Data.Text as T
|
|||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
cmdmode = hledgerCommandMode
|
cmdmode = hledgerCommandMode
|
||||||
[here| dupes
|
[here| check-dupes
|
||||||
Reports duplicates in the account tree: account names having the same leaf
|
Reports duplicates in the account tree: account names having the same leaf
|
||||||
but different prefixes. In other words, two or more leaves that are
|
but different prefixes. In other words, two or more leaves that are
|
||||||
categorized differently.
|
categorized differently.
|
||||||
@ -37,7 +37,7 @@ http://stefanorodighiero.net/software/hledger-dupes.html
|
|||||||
main = do
|
main = do
|
||||||
opts <- getHledgerCliOpts cmdmode
|
opts <- getHledgerCliOpts cmdmode
|
||||||
withJournalDo opts $ \CliOpts{rawopts_=_opts,reportopts_=_ropts} j -> do
|
withJournalDo opts $ \CliOpts{rawopts_=_opts,reportopts_=_ropts} j -> do
|
||||||
mapM_ render $ dupes $ accountsNames j
|
mapM_ render $ checkdupes $ accountsNames j
|
||||||
|
|
||||||
accountsNames :: Journal -> [(String, AccountName)]
|
accountsNames :: Journal -> [(String, AccountName)]
|
||||||
accountsNames j = map leafAndAccountName as
|
accountsNames j = map leafAndAccountName as
|
||||||
@ -46,8 +46,8 @@ accountsNames j = map leafAndAccountName as
|
|||||||
as = nub $ sort $ map paccount ps
|
as = nub $ sort $ map paccount ps
|
||||||
|
|
||||||
|
|
||||||
dupes :: (Ord k, Eq k) => [(k, v)] -> [(k, [v])]
|
checkdupes :: (Ord k, Eq k) => [(k, v)] -> [(k, [v])]
|
||||||
dupes l = zip dupLeafs dupAccountNames
|
checkdupes l = zip dupLeafs dupAccountNames
|
||||||
where dupLeafs = map (fst . head) d
|
where dupLeafs = map (fst . head) d
|
||||||
dupAccountNames = map (map snd) d
|
dupAccountNames = map (map snd) d
|
||||||
d = dupes' l
|
d = dupes' l
|
||||||
@ -94,9 +94,9 @@ checks more powerful account balance assertions.
|
|||||||
[hledger-check-dates.hs](https://github.com/simonmichael/hledger/blob/master/bin/hledger-check-dates.hs#L15)
|
[hledger-check-dates.hs](https://github.com/simonmichael/hledger/blob/master/bin/hledger-check-dates.hs#L15)
|
||||||
checks that journal entries are ordered by date.
|
checks that journal entries are ordered by date.
|
||||||
|
|
||||||
### dupes
|
### check-dupes
|
||||||
|
|
||||||
[hledger-dupes.hs](https://github.com/simonmichael/hledger/blob/master/bin/hledger-dupes.hs#L21)
|
[hledger-check-dupes.hs](https://github.com/simonmichael/hledger/blob/master/bin/hledger-check-dupes.hs#L21)
|
||||||
checks for account names sharing the same leaf name.
|
checks for account names sharing the same leaf name.
|
||||||
|
|
||||||
### equity
|
### equity
|
||||||
|
|||||||
@ -119,7 +119,7 @@ Some experimental commands are not built in to hledger, but
|
|||||||
[add-on commands](http://hledger.org/hledger.html#add-on-commands), such as:\
|
[add-on commands](http://hledger.org/hledger.html#add-on-commands), such as:\
|
||||||
`chart`,
|
`chart`,
|
||||||
`check-dates`,
|
`check-dates`,
|
||||||
`dupes`,
|
`check-dupes`,
|
||||||
`equity`,
|
`equity`,
|
||||||
`print-unique`,
|
`print-unique`,
|
||||||
`register-match`,
|
`register-match`,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user