Format mima state
Also, use the new formatter in mima-run (and while we're at it, clean up flag file loading and prepare for symbol file loading).
This commit is contained in:
parent
45ec7d1708
commit
8bfce48a7f
4 changed files with 273 additions and 41 deletions
28
src/Mima/Options.hs
Normal file
28
src/Mima/Options.hs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
module Mima.Options
|
||||
( switchWithNo
|
||||
, formatConfigParser
|
||||
) where
|
||||
|
||||
import Options.Applicative
|
||||
|
||||
import Mima.Format.State
|
||||
|
||||
switchWithNo :: String -> Bool -> Mod FlagFields Bool -> Parser Bool
|
||||
switchWithNo name True fields = flag' False (long ("no-" ++ name) <> fields)
|
||||
<|> flag True True (long name <> fields)
|
||||
switchWithNo name False fields = flag' True (long name <> fields)
|
||||
<|> flag False False (long ("no-" ++ name) <> fields)
|
||||
|
||||
formatConfigParser :: Parser FormatConfig
|
||||
formatConfigParser = FormatConfig
|
||||
<$> switchWithNo "sparse" False mempty
|
||||
<*> switchWithNo "register-flags" True mempty
|
||||
<*> switchWithNo "memory-flags" True mempty
|
||||
<*> switchWithNo "address-dec" True mempty
|
||||
<*> switchWithNo "address-hex" True mempty
|
||||
<*> switchWithNo "address-bin" False mempty
|
||||
<*> switchWithNo "word-dec" True mempty
|
||||
<*> switchWithNo "word-hex" True mempty
|
||||
<*> switchWithNo "word-bin" False mempty
|
||||
<*> switchWithNo "instructions" True mempty
|
||||
<*> switchWithNo "labels" True mempty
|
||||
Loading…
Add table
Add a link
Reference in a new issue