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" ++
|
||||
" hledger convert CSVFILE ACCOUNTNAME RULESFILE\n" ++
|
||||
"\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" ++
|
||||
"hledger uses your ~/.ledger or $LEDGER file (or another specified with -f),\n" ++
|
||||
"while hours uses your ~/.timelog or $TIMELOG file.\n" ++
|
||||
"\n" ++
|
||||
"COMMAND is one of (may be abbreviated):\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
|
||||
-- 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
|
||||
-- as \"hours\", the -f $TIMELOG -p today options are assumed as a default.
|
||||
-- YYYY/MM/DD format based on the current time.
|
||||
parseArguments :: IO ([Opt], String, [String])
|
||||
parseArguments = do
|
||||
args <- liftM (map decodeString) getArgs
|
||||
let (os,as,es) = getOpt Permute options args
|
||||
istimequery <- usingTimeProgramName
|
||||
let os' = if istimequery then (Period "today"):os else os
|
||||
os'' <- fixOptDates os'
|
||||
-- istimequery <- usingTimeProgramName
|
||||
-- let os' = if istimequery then (Period "today"):os else os
|
||||
os'' <- fixOptDates os
|
||||
case (as,es) of
|
||||
(cmd:args,[]) -> return (os'',cmd,args)
|
||||
([],[]) -> return (os'',"",[])
|
||||
|
||||
11
README
11
README
@ -62,8 +62,7 @@ Time reporting
|
||||
|
||||
hledger will also read timeclock.el-format timelog entries. As a
|
||||
convenience, if you invoke hledger via a link or copy named "hours", it
|
||||
uses your timelog file (~/.timelog or $TIMELOG) and --period today as
|
||||
defaults.::
|
||||
uses your timelog file (~/.timelog or $TIMELOG) by default.::
|
||||
|
||||
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
|
||||
export TIMELOG=sample.timelog
|
||||
hours # time logged today, if any
|
||||
hours 'last month' # last month
|
||||
hours thisyear # the space is optional
|
||||
hours 'from 1/15' register proj # project sessions since last jan 15
|
||||
hours 'weekly this year' reg --depth 1 # weekly time summary
|
||||
hours -p 'last month' # last month
|
||||
hours -p thisyear # the space is optional
|
||||
hours -p 'from 1/15' register proj # project sessions since last jan 15
|
||||
hours -p 'weekly this year' reg --depth 1 # weekly time summary
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user