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