restore web/vty/chart's special flags as hidden options for now
This commit is contained in:
parent
f58ce26407
commit
188d936889
@ -5,6 +5,7 @@ Command-line options for the application.
|
|||||||
|
|
||||||
module Hledger.Cli.Options
|
module Hledger.Cli.Options
|
||||||
where
|
where
|
||||||
|
import Safe (headDef)
|
||||||
import System.Console.GetOpt
|
import System.Console.GetOpt
|
||||||
import System.Environment
|
import System.Environment
|
||||||
import Hledger.Cli.Version (timeprogname)
|
import Hledger.Cli.Version (timeprogname)
|
||||||
@ -40,7 +41,9 @@ help1 =
|
|||||||
"Use --help-options to see OPTIONS, or --help-all/-H.\n" ++
|
"Use --help-options to see OPTIONS, or --help-all/-H.\n" ++
|
||||||
""
|
""
|
||||||
|
|
||||||
help2 = usageInfo "Options:\n" options
|
help2 = usageInfo "Options:\n" options'
|
||||||
|
where options' = filter (\(Option _ name _ _) -> not $ (headDef "" name) `elem` hiddenoptions) options
|
||||||
|
hiddenoptions = ["base-url","port","debug-vty","output","items","size"]
|
||||||
|
|
||||||
-- | Command-line options we accept.
|
-- | Command-line options we accept.
|
||||||
options :: [OptDescr Opt]
|
options :: [OptDescr Opt]
|
||||||
@ -75,8 +78,22 @@ options = [
|
|||||||
,Option "h" ["help"] (NoArg Help) "show basic command-line usage"
|
,Option "h" ["help"] (NoArg Help) "show basic command-line usage"
|
||||||
,Option "" ["help-options"] (NoArg HelpOptions) "show command-line options"
|
,Option "" ["help-options"] (NoArg HelpOptions) "show command-line options"
|
||||||
,Option "H" ["help-all"] (NoArg HelpAll) "show command-line usage and options"
|
,Option "H" ["help-all"] (NoArg HelpAll) "show command-line usage and options"
|
||||||
|
-- hidden options needed for add-ons, for now
|
||||||
|
,Option "" ["base-url"] (ReqArg BaseUrl "URL") "web: use this base url (default http://localhost:PORT)"
|
||||||
|
,Option "" ["port"] (ReqArg Port "N") "web: serve on tcp port N (default 5000)"
|
||||||
|
,Option "" ["debug-vty"] (NoArg DebugVty) "vty: run with no terminal output, showing console"
|
||||||
|
,Option "o" ["output"] (ReqArg ChartOutput "FILE") ("chart: output filename (default: "++chartoutput++")")
|
||||||
|
,Option "" ["items"] (ReqArg ChartItems "N") ("chart: number of accounts to show (default: "++show chartitems++")")
|
||||||
|
,Option "" ["size"] (ReqArg ChartSize "WIDTHxHEIGHT") ("chart: image size (default: "++chartsize++")")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
-- - " vty - run a simple curses-style UI" ++
|
||||||
|
-- - " web - run a simple web-based UI" ++
|
||||||
|
-- - " chart - generate balances pie charts" ++
|
||||||
|
chartoutput = "hledger.png"
|
||||||
|
chartitems = 10
|
||||||
|
chartsize = "600x400"
|
||||||
|
|
||||||
-- | An option value from a command-line flag.
|
-- | An option value from a command-line flag.
|
||||||
data Opt =
|
data Opt =
|
||||||
File {value::String} |
|
File {value::String} |
|
||||||
@ -101,8 +118,6 @@ data Opt =
|
|||||||
MonthlyOpt |
|
MonthlyOpt |
|
||||||
QuarterlyOpt |
|
QuarterlyOpt |
|
||||||
YearlyOpt |
|
YearlyOpt |
|
||||||
BaseUrl {value::String} |
|
|
||||||
Port {value::String} |
|
|
||||||
Help |
|
Help |
|
||||||
HelpOptions |
|
HelpOptions |
|
||||||
HelpAll |
|
HelpAll |
|
||||||
@ -110,7 +125,13 @@ data Opt =
|
|||||||
Version
|
Version
|
||||||
| BinaryFilename
|
| BinaryFilename
|
||||||
| Debug
|
| Debug
|
||||||
|
--
|
||||||
| DebugVty
|
| DebugVty
|
||||||
|
| BaseUrl {value::String}
|
||||||
|
| Port {value::String}
|
||||||
|
| ChartOutput {value::String}
|
||||||
|
| ChartItems {value::String}
|
||||||
|
| ChartSize {value::String}
|
||||||
deriving (Show,Eq)
|
deriving (Show,Eq)
|
||||||
|
|
||||||
-- these make me nervous
|
-- these make me nervous
|
||||||
@ -276,4 +297,3 @@ optsToFilterSpec opts args t = FilterSpec {
|
|||||||
-- where
|
-- where
|
||||||
-- listtomaybe [] = Nothing
|
-- listtomaybe [] = Nothing
|
||||||
-- listtomaybe vs = Just $ last vs
|
-- listtomaybe vs = Just $ last vs
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user