make hours just like hledger, aside from the choice of file
This commit is contained in:
parent
287c51e5ba
commit
8162fc6f89
13
Options.hs
13
Options.hs
@ -29,8 +29,8 @@ usagehdr = (
|
|||||||
" hours [OPTIONS] [COMMAND [PATTERNS]]\n" ++
|
" hours [OPTIONS] [COMMAND [PATTERNS]]\n" ++
|
||||||
" hledger convert CSVFILE ACCOUNTNAME RULESFILE\n" ++
|
" hledger convert CSVFILE ACCOUNTNAME RULESFILE\n" ++
|
||||||
"\n" ++
|
"\n" ++
|
||||||
"hledger uses your ~/.ledger or $LEDGER file (or another specified with -f).\n" ++
|
"hledger uses your ~/.ledger or $LEDGER file (or another specified with -f),\n" ++
|
||||||
"hours uses your ~/.timelog or $TIMELOG, and --period today as default.\n" ++
|
"while hours uses your ~/.timelog or $TIMELOG file.\n" ++
|
||||||
"\n" ++
|
"\n" ++
|
||||||
"COMMAND is one of (may be abbreviated):\n" ++
|
"COMMAND is one of (may be abbreviated):\n" ++
|
||||||
" add - prompt for new transactions and add them to the ledger\n" ++
|
" add - prompt for new transactions and add them to the ledger\n" ++
|
||||||
@ -126,15 +126,14 @@ optValuesForConstructors fs opts = concatMap get opts
|
|||||||
|
|
||||||
-- | Parse the command-line arguments into options, command name, and
|
-- | Parse the command-line arguments into options, command name, and
|
||||||
-- command arguments. Any dates in the options are converted to explicit
|
-- command arguments. Any dates in the options are converted to explicit
|
||||||
-- YYYY/MM/DD format based on the current time. If the program was invoked
|
-- YYYY/MM/DD format based on the current time.
|
||||||
-- as \"hours\", the -f $TIMELOG -p today options are assumed as a default.
|
|
||||||
parseArguments :: IO ([Opt], String, [String])
|
parseArguments :: IO ([Opt], String, [String])
|
||||||
parseArguments = do
|
parseArguments = do
|
||||||
args <- liftM (map decodeString) getArgs
|
args <- liftM (map decodeString) getArgs
|
||||||
let (os,as,es) = getOpt Permute options args
|
let (os,as,es) = getOpt Permute options args
|
||||||
istimequery <- usingTimeProgramName
|
-- istimequery <- usingTimeProgramName
|
||||||
let os' = if istimequery then (Period "today"):os else os
|
-- let os' = if istimequery then (Period "today"):os else os
|
||||||
os'' <- fixOptDates os'
|
os'' <- fixOptDates os
|
||||||
case (as,es) of
|
case (as,es) of
|
||||||
(cmd:args,[]) -> return (os'',cmd,args)
|
(cmd:args,[]) -> return (os'',cmd,args)
|
||||||
([],[]) -> return (os'',"",[])
|
([],[]) -> return (os'',"",[])
|
||||||
|
|||||||
11
README
11
README
@ -62,8 +62,7 @@ Time reporting
|
|||||||
|
|
||||||
hledger will also read timeclock.el-format timelog entries. As a
|
hledger will also read timeclock.el-format timelog entries. As a
|
||||||
convenience, if you invoke hledger via a link or copy named "hours", it
|
convenience, if you invoke hledger via a link or copy named "hours", it
|
||||||
uses your timelog file (~/.timelog or $TIMELOG) and --period today as
|
uses your timelog file (~/.timelog or $TIMELOG) by default.::
|
||||||
defaults.::
|
|
||||||
|
|
||||||
hours [OPTIONS] [COMMAND [PATTERNS]]
|
hours [OPTIONS] [COMMAND [PATTERNS]]
|
||||||
|
|
||||||
@ -77,10 +76,10 @@ The clockin description is an account name. Here are some queries to try::
|
|||||||
ln -s `which hledger` ~/bin/hours # add the "hours" symlink in your path
|
ln -s `which hledger` ~/bin/hours # add the "hours" symlink in your path
|
||||||
export TIMELOG=sample.timelog
|
export TIMELOG=sample.timelog
|
||||||
hours # time logged today, if any
|
hours # time logged today, if any
|
||||||
hours 'last month' # last month
|
hours -p 'last month' # last month
|
||||||
hours thisyear # the space is optional
|
hours -p thisyear # the space is optional
|
||||||
hours 'from 1/15' register proj # project sessions since last jan 15
|
hours -p 'from 1/15' register proj # project sessions since last jan 15
|
||||||
hours 'weekly this year' reg --depth 1 # weekly time summary
|
hours -p 'weekly this year' reg --depth 1 # weekly time summary
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user