;lib: comments
This commit is contained in:
parent
1afb84c95d
commit
fe846a0c7f
@ -208,20 +208,25 @@ useColorOnHandle h = unsafePerformIO $ do
|
||||
-- (When running code in GHCI, this module must be reloaded to see a change.)
|
||||
-- {-# OPTIONS_GHC -fno-cse #-}
|
||||
-- {-# NOINLINE colorOption #-}
|
||||
-- Keep synced with color/colour flag definition in hledger:CliOptions
|
||||
colorOption :: String
|
||||
colorOption =
|
||||
-- similar to debugLevel
|
||||
let args = unsafePerformIO getArgs in
|
||||
case snd $ break (=="--color") args of
|
||||
-- --color ARG
|
||||
"--color":v:_ -> v
|
||||
_ ->
|
||||
case take 1 $ filter ("--color=" `isPrefixOf`) args of
|
||||
-- --color=ARG
|
||||
['-':'-':'c':'o':'l':'o':'r':'=':v] -> v
|
||||
_ ->
|
||||
case snd $ break (=="--colour") args of
|
||||
-- --colour ARG
|
||||
"--colour":v:_ -> v
|
||||
_ ->
|
||||
case take 1 $ filter ("--colour=" `isPrefixOf`) args of
|
||||
-- --colour=ARG
|
||||
['-':'-':'c':'o':'l':'o':'u':'r':'=':v] -> v
|
||||
_ -> ""
|
||||
|
||||
|
||||
@ -191,6 +191,7 @@ reportflags = [
|
||||
|
||||
-- general output-related
|
||||
|
||||
-- This has special support in hledger-lib:colorOption, keep synced
|
||||
,flagReq ["color","colour"] (\s opts -> Right $ setopt "color" s opts) "WHEN"
|
||||
(unlines
|
||||
["Should color-supporting commands use ANSI color codes in text output."
|
||||
@ -228,6 +229,7 @@ outputFormatFlag fmts = flagReq
|
||||
["output-format","O"] (\s opts -> Right $ setopt "output-format" s opts) "FMT"
|
||||
("select the output format. Supported formats:\n" ++ intercalate ", " fmts ++ ".")
|
||||
|
||||
-- This has special support in hledger-lib:outputFileOption, keep synced
|
||||
outputFileFlag :: Flag RawOpts
|
||||
outputFileFlag = flagReq
|
||||
["output-file","o"] (\s opts -> Right $ setopt "output-file" s opts) "FILE"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user