[Optparse] s/##/<=>/g
This commit is contained in:
parent
67cabf3cdf
commit
01e1a83c25
@ -17,17 +17,17 @@ parseArgs =
|
||||
where
|
||||
opts = info (argAndCmdSpec <**> helpVersion)
|
||||
$$ fullDesc
|
||||
## header "ghc-mod: Happy Haskell Programming"
|
||||
<=> header "ghc-mod: Happy Haskell Programming"
|
||||
|
||||
helpVersion :: Parser (a -> a)
|
||||
helpVersion =
|
||||
helper
|
||||
<*> abortOption (InfoMsg ghcModVersion)
|
||||
$$ long "version"
|
||||
## help "Print the version of the program."
|
||||
<=> help "Print the version of the program."
|
||||
<*> argument r
|
||||
$$ value id
|
||||
## metavar ""
|
||||
<=> metavar ""
|
||||
where
|
||||
r :: ReadM (a -> a)
|
||||
r = do
|
||||
@ -56,61 +56,61 @@ logLevelParser =
|
||||
logLevelOption =
|
||||
option int
|
||||
$$ long "verbose"
|
||||
## metavar "LEVEL"
|
||||
## value 4
|
||||
## showDefault
|
||||
## help "Set log level. (0-7)"
|
||||
<=> metavar "LEVEL"
|
||||
<=> value 4
|
||||
<=> showDefault
|
||||
<=> help "Set log level. (0-7)"
|
||||
logLevelSwitch =
|
||||
(4+) . length <$> many $$ flag' ()
|
||||
$$ short 'v'
|
||||
## help "Increase log level"
|
||||
<=> help "Increase log level"
|
||||
silentSwitch = flag' 0
|
||||
$$ long "silent"
|
||||
## short 's'
|
||||
## help "Be silent, set log level to 0"
|
||||
<=> short 's'
|
||||
<=> help "Be silent, set log level to 0"
|
||||
|
||||
outputOptsSpec :: Parser OutputOpts
|
||||
outputOptsSpec = OutputOpts
|
||||
<$> logLevelParser
|
||||
<*> flag PlainStyle LispStyle
|
||||
$$ long "tolisp"
|
||||
## short 'l'
|
||||
## help "Format output as an S-Expression"
|
||||
<=> short 'l'
|
||||
<=> help "Format output as an S-Expression"
|
||||
<*> LineSeparator <$$> strOption
|
||||
$$ long "boundary"
|
||||
## long "line-separator"
|
||||
## short 'b'
|
||||
## metavar "SEP"
|
||||
## value "\0"
|
||||
## showDefault
|
||||
## help "Output line separator"
|
||||
<=> long "line-separator"
|
||||
<=> short 'b'
|
||||
<=> metavar "SEP"
|
||||
<=> value "\0"
|
||||
<=> showDefault
|
||||
<=> help "Output line separator"
|
||||
<*> optional $$ splitOn ',' <$$> strOption
|
||||
$$ long "line-prefix"
|
||||
## metavar "OUT,ERR"
|
||||
## help "Output prefixes"
|
||||
<=> metavar "OUT,ERR"
|
||||
<=> help "Output prefixes"
|
||||
|
||||
programsArgSpec :: Parser Programs
|
||||
programsArgSpec = Programs
|
||||
<$> strOption
|
||||
$$ long "with-ghc"
|
||||
## value "ghc"
|
||||
## showDefault
|
||||
## help "GHC executable to use"
|
||||
<=> value "ghc"
|
||||
<=> showDefault
|
||||
<=> help "GHC executable to use"
|
||||
<*> strOption
|
||||
$$ long "with-ghc-pkg"
|
||||
## value "ghc-pkg"
|
||||
## showDefault
|
||||
## help "ghc-pkg executable to use (only needed when guessing from GHC path fails)"
|
||||
<=> value "ghc-pkg"
|
||||
<=> showDefault
|
||||
<=> help "ghc-pkg executable to use (only needed when guessing from GHC path fails)"
|
||||
<*> strOption
|
||||
$$ long "with-cabal"
|
||||
## value "cabal"
|
||||
## showDefault
|
||||
## help "cabal-install executable to use"
|
||||
<=> value "cabal"
|
||||
<=> showDefault
|
||||
<=> help "cabal-install executable to use"
|
||||
<*> strOption
|
||||
$$ long "with-stack"
|
||||
## value "stack"
|
||||
## showDefault
|
||||
## help "stack executable to use"
|
||||
<=> value "stack"
|
||||
<=> showDefault
|
||||
<=> help "stack executable to use"
|
||||
|
||||
globalArgSpec :: Parser Options
|
||||
globalArgSpec = Options
|
||||
@ -118,10 +118,10 @@ globalArgSpec = Options
|
||||
<*> programsArgSpec
|
||||
<*> many $$ strOption
|
||||
$$ long "ghcOpt"
|
||||
## long "ghc-option"
|
||||
## short 'g'
|
||||
## metavar "OPT"
|
||||
## help "Option to be passed to GHC"
|
||||
<=> long "ghc-option"
|
||||
<=> short 'g'
|
||||
<=> metavar "OPT"
|
||||
<=> help "Option to be passed to GHC"
|
||||
<*> many fileMappingSpec
|
||||
where
|
||||
{-
|
||||
@ -161,6 +161,6 @@ globalArgSpec = Options
|
||||
fileMappingSpec =
|
||||
getFileMapping . splitOn '=' <$> strOption
|
||||
$$ long "map-file"
|
||||
## metavar "MAPPING"
|
||||
## help "Redirect one file to another, --map-file \"file1.hs=file2.hs\""
|
||||
<=> metavar "MAPPING"
|
||||
<=> help "Redirect one file to another, --map-file \"file1.hs=file2.hs\""
|
||||
getFileMapping = second (\i -> if null i then Nothing else Just i)
|
||||
|
@ -57,8 +57,8 @@ commandsSpec =
|
||||
<> command "boot"
|
||||
$$ info (pure CmdBoot)
|
||||
$$ progDesc "Internal command used by the emacs frontend"
|
||||
-- <> command "nuke-caches" (
|
||||
-- info (pure CmdNukeCaches) idm)
|
||||
-- <> command "nuke-caches"
|
||||
-- $$ info (pure CmdNukeCaches) idm
|
||||
<> command "root"
|
||||
$$ info (pure CmdRoot)
|
||||
$$ progDesc
|
||||
@ -92,7 +92,8 @@ commandsSpec =
|
||||
$$ progDesc "List symbols in a module"
|
||||
<> command "check"
|
||||
$$ info checkArgSpec
|
||||
$$ progDesc "Load the given files using GHC and report errors/warnings,\
|
||||
$$ progDesc
|
||||
"Load the given files using GHC and report errors/warnings,\
|
||||
\ but don't produce output files"
|
||||
<> command "expand"
|
||||
$$ info expandArgSpec
|
||||
@ -110,7 +111,7 @@ commandsSpec =
|
||||
$$ info splitArgSpec
|
||||
$$ progDesc
|
||||
"Split a function case by examining a type's constructors"
|
||||
## desc [
|
||||
<=> desc [
|
||||
text "For example given the following code snippet:"
|
||||
, code [
|
||||
"f :: [a] -> a"
|
||||
@ -127,7 +128,7 @@ commandsSpec =
|
||||
<> command "sig"
|
||||
$$ info sigArgSpec
|
||||
$$ progDesc "Generate initial code given a signature"
|
||||
## desc [
|
||||
<=> desc [
|
||||
text "For example when (LINE,COL) is on the signature in the following\
|
||||
\ code snippet:"
|
||||
, code ["func :: [a] -> Maybe b -> (a -> b) -> (a,b)"]
|
||||
@ -141,7 +142,7 @@ commandsSpec =
|
||||
<> command "refine"
|
||||
$$ info refineArgSpec
|
||||
$$ progDesc "Refine the typed hole at (LINE,COL) given EXPR"
|
||||
## desc [
|
||||
<=> desc [
|
||||
text "For example if EXPR is `filter', which has type `(a -> Bool) -> [a]\
|
||||
\ -> [a]' and (LINE,COL) is on the hole `_body' in the following\
|
||||
\ code snippet:"
|
||||
@ -177,31 +178,31 @@ modulesArgSpec, dumpSymArgSpec, docArgSpec, findArgSpec,
|
||||
modulesArgSpec = CmdModules
|
||||
<$> switch
|
||||
$$ long "detailed"
|
||||
## short 'd'
|
||||
## help "Print package modules belong to"
|
||||
<=> short 'd'
|
||||
<=> help "Print package modules belong to"
|
||||
dumpSymArgSpec = CmdDumpSym <$> strArg "TMPDIR"
|
||||
findArgSpec = CmdFind <$> strArg "SYMBOL"
|
||||
docArgSpec = CmdDoc <$> strArg "MODULE"
|
||||
lintArgSpec = CmdLint
|
||||
<$> LintOpts <$$> many $$ strOption
|
||||
$$ long "hlintOpt"
|
||||
## short 'h'
|
||||
## help "Option to be passed to hlint"
|
||||
<=> short 'h'
|
||||
<=> help "Option to be passed to hlint"
|
||||
<*> strArg "FILE"
|
||||
browseArgSpec = CmdBrowse
|
||||
<$> (BrowseOpts
|
||||
<$> switch
|
||||
$$ long "operators"
|
||||
## short 'o'
|
||||
## help "Also print operators"
|
||||
<=> short 'o'
|
||||
<=> help "Also print operators"
|
||||
<*> switch
|
||||
$$ long "detailed"
|
||||
## short 'd'
|
||||
## help "Print symbols with accompanying signature"
|
||||
<=> short 'd'
|
||||
<=> help "Print symbols with accompanying signature"
|
||||
<*> switch
|
||||
$$ long "qualified"
|
||||
## short 'q'
|
||||
## help "Qualify symbols"
|
||||
<=> short 'q'
|
||||
<=> help "Qualify symbols"
|
||||
)
|
||||
<*> some (strArg "MODULE")
|
||||
debugComponentArgSpec = filesArgsSpec CmdDebugComponent
|
||||
|
@ -3,7 +3,7 @@ module GHCMod.Options.DocUtils (
|
||||
desc,
|
||||
code,
|
||||
($$),
|
||||
(##),
|
||||
(<=>),
|
||||
(<$$>),
|
||||
(<||>)
|
||||
) where
|
||||
@ -21,7 +21,7 @@ code x = vsep [line, indent 4 $ vsep $ map text x, line]
|
||||
infixl 7 <||>
|
||||
infixr 8 <$$>
|
||||
infixr 8 $$
|
||||
infixr 9 ##
|
||||
infixr 9 <=>
|
||||
|
||||
($$) :: (a -> b) -> a -> b
|
||||
($$) = ($)
|
||||
@ -29,8 +29,8 @@ infixr 9 ##
|
||||
(<||>) :: Alternative a => a b -> a b -> a b
|
||||
(<||>) = (<|>)
|
||||
|
||||
(##) :: Monoid m => m -> m -> m
|
||||
(##) = (<>)
|
||||
(<=>) :: Monoid m => m -> m -> m
|
||||
(<=>) = (<>)
|
||||
|
||||
(<$$>) :: Functor f => (a -> b) -> f a -> f b
|
||||
(<$$>) = (<$>)
|
||||
|
Loading…
Reference in New Issue
Block a user