Add help for formatting options
This commit is contained in:
parent
8bfce48a7f
commit
0d18329354
2 changed files with 33 additions and 16 deletions
|
|
@ -71,7 +71,7 @@ settingsParser = Settings
|
||||||
<*> formatConfigParser
|
<*> formatConfigParser
|
||||||
|
|
||||||
opts :: ParserInfo Settings
|
opts :: ParserInfo Settings
|
||||||
opts = info (helper <*> settingsParser) $ fullDesc <> failureCode 1
|
opts = info (helper <*> settingsParser) $ fullDesc <> failureCode 1 <> footer formatConfigHelp
|
||||||
|
|
||||||
{- Loading the flag file -}
|
{- Loading the flag file -}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
module Mima.Options
|
module Mima.Options
|
||||||
( switchWithNo
|
( switchWithNo
|
||||||
|
, formatConfigHelp
|
||||||
, formatConfigParser
|
, formatConfigParser
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
|
@ -8,21 +9,37 @@ import Options.Applicative
|
||||||
import Mima.Format.State
|
import Mima.Format.State
|
||||||
|
|
||||||
switchWithNo :: String -> Bool -> Mod FlagFields Bool -> Parser Bool
|
switchWithNo :: String -> Bool -> Mod FlagFields Bool -> Parser Bool
|
||||||
switchWithNo name True fields = flag' False (long ("no-" ++ name) <> fields)
|
switchWithNo name defaultValue fields
|
||||||
<|> flag True True (long name <> fields)
|
| defaultValue = flag' False noMod <|> flag True True yesMod
|
||||||
switchWithNo name False fields = flag' True (long name <> fields)
|
| otherwise = flag' True yesMod <|> flag False False noMod
|
||||||
<|> flag False False (long ("no-" ++ name) <> fields)
|
where
|
||||||
|
yesMod = long name <> hidden <> fields
|
||||||
|
noMod = long ("no-" ++ name) <> hidden
|
||||||
|
|
||||||
|
formatConfigHelp :: String
|
||||||
|
formatConfigHelp = "All options labeled with 'Formatting:' can be negated by prepending 'no-' to their name (e. g. '--sparse' becomes '--no-sparse')."
|
||||||
|
|
||||||
formatConfigParser :: Parser FormatConfig
|
formatConfigParser :: Parser FormatConfig
|
||||||
formatConfigParser = FormatConfig
|
formatConfigParser = FormatConfig
|
||||||
<$> switchWithNo "sparse" False mempty
|
<$> switchWithNo "sparse" False
|
||||||
<*> switchWithNo "register-flags" True mempty
|
(help "Formatting: Omit uninteresting addresses")
|
||||||
<*> switchWithNo "memory-flags" True mempty
|
<*> switchWithNo "register-flags" True
|
||||||
<*> switchWithNo "address-dec" True mempty
|
(help "Formatting: For each address, show all the memory flags that are active for that address")
|
||||||
<*> switchWithNo "address-hex" True mempty
|
<*> switchWithNo "memory-flags" True
|
||||||
<*> switchWithNo "address-bin" False mempty
|
(help "Formatting: For each address, show all registers currently pointing to that address")
|
||||||
<*> switchWithNo "word-dec" True mempty
|
<*> switchWithNo "address-dec" True
|
||||||
<*> switchWithNo "word-hex" True mempty
|
(help "Formatting: Display addresses in decimal")
|
||||||
<*> switchWithNo "word-bin" False mempty
|
<*> switchWithNo "address-hex" True
|
||||||
<*> switchWithNo "instructions" True mempty
|
(help "Formatting: Display addresses in hexadecimal")
|
||||||
<*> switchWithNo "labels" True mempty
|
<*> switchWithNo "address-bin" False
|
||||||
|
(help "Formatting: Display addresses in binary")
|
||||||
|
<*> switchWithNo "word-dec" True
|
||||||
|
(help "Formatting: Display words in decimal")
|
||||||
|
<*> switchWithNo "word-hex" True
|
||||||
|
(help "Formatting: Display words in hexadecimal")
|
||||||
|
<*> switchWithNo "word-bin" False
|
||||||
|
(help "Formatting: Display words in binary")
|
||||||
|
<*> switchWithNo "instructions" True
|
||||||
|
(help "Formatting: Show instructions")
|
||||||
|
<*> switchWithNo "labels" True
|
||||||
|
(help "Formatting: Show labels from the symbol file")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue