addunused, dropunused: Support --json and --json-error-messages
This also changes addunused to display the names of the files that it adds. That seems like a general usability improvement, and not displaying the input number does not seem likely to be a problem to a user, since the filename is based on the key. Displaying the filename was necessary to get it and the key included in the json. dropunused does not include the key in the json. It would be possible to add, but would need more changes. And I doubt that dropunused --json would be used in a situation where a program cared which keys were dropped. Note that drop --unused does have the key in its json, so such a program could just use it. Or could just dropkey --batch with the specific keys it wants to drop if it cares about specific keys. Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
parent
972fd05688
commit
1a9af823bc
7 changed files with 69 additions and 39 deletions
|
@ -322,12 +322,12 @@ unusedSpec m spec
|
|||
|
||||
{- Seek action for unused content. Finds the number in the maps, and
|
||||
- calls one of 3 actions, depending on the type of unused file. -}
|
||||
startUnused :: String
|
||||
-> (Key -> CommandPerform)
|
||||
-> (Key -> CommandPerform)
|
||||
-> (Key -> CommandPerform)
|
||||
startUnused
|
||||
:: (Int -> Key -> CommandStart)
|
||||
-> (Int -> Key -> CommandStart)
|
||||
-> (Int -> Key -> CommandStart)
|
||||
-> UnusedMaps -> Int -> CommandStart
|
||||
startUnused message unused badunused tmpunused maps n = search
|
||||
startUnused unused badunused tmpunused maps n = search
|
||||
[ (unusedMap maps, unused)
|
||||
, (unusedBadMap maps, badunused)
|
||||
, (unusedTmpMap maps, tmpunused)
|
||||
|
@ -337,7 +337,4 @@ startUnused message unused badunused tmpunused maps n = search
|
|||
search ((m, a):rest) =
|
||||
case M.lookup n m of
|
||||
Nothing -> search rest
|
||||
Just key -> starting message
|
||||
(ActionItemOther $ Just $ UnquotedString $ show n)
|
||||
(SeekInput [])
|
||||
(a key)
|
||||
Just key -> a n key
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue