lib: drop the file format auto-detection feature
For a long time hledger has auto-detected the file format when it's
not known, eg when reading from a file with unusual extension (like
.dat or .txt), or from standard input (-f-), or when using the include
directive (which currently ignores file extensions).
Auto-detecting has been done by trying all readers until one succeeds.
This could guess wrong in some cases, but it was so rare that it has
been working fine.
Recently, more conveniences have been added to timedot format,
increasing its overlap with journal format, which makes this kind of
auto-detection unreliable.
Auto-detection and auto-detection failures are (probably) still pretty
rare in practice. But when it does happen it's confusing, giving
misleading errors or false successes (eg printing timedot entries
instead of a journal error).
For predictability and to minimise confusion, hledger no longer tries
to guess; when there's no file extension or reader prefix, it assumes
journal format. To specify one of the other formats, you must use a
standard file extension (.timeclock, .timedot, .csv, .ssv, .tsv), or a
reader prefix (-f csv:foo.txt, -f timedot:-).
For now, the include directive still tries to autodetect
(journal/timeclock/timedot), and this can't be overridden; it will be
fixed later.
Experimental; testing and feedback welcome.
2020-02-29 20:17:39 +03:00
|
|
|
# 1. a timeclock session is parsed as a similarly-named transaction with one virtual posting.
|
|
|
|
# Note since 1.17 we need to specify stdin's format explicitly.
|
2020-01-12 13:26:30 +03:00
|
|
|
<
|
2015-04-28 23:54:36 +03:00
|
|
|
i 2009/1/1 08:00:00
|
|
|
|
o 2009/1/1 09:00:00 stuff on checkout record is ignored
|
2009-12-08 02:29:19 +03:00
|
|
|
|
2015-04-28 23:54:36 +03:00
|
|
|
i 2009/1/2 08:00:00 account name
|
|
|
|
o 2009/1/2 09:00:00
|
|
|
|
i 2009/1/3 08:00:00 some:account name and a description
|
|
|
|
o 2009/1/3 09:00:00
|
lib: drop the file format auto-detection feature
For a long time hledger has auto-detected the file format when it's
not known, eg when reading from a file with unusual extension (like
.dat or .txt), or from standard input (-f-), or when using the include
directive (which currently ignores file extensions).
Auto-detecting has been done by trying all readers until one succeeds.
This could guess wrong in some cases, but it was so rare that it has
been working fine.
Recently, more conveniences have been added to timedot format,
increasing its overlap with journal format, which makes this kind of
auto-detection unreliable.
Auto-detection and auto-detection failures are (probably) still pretty
rare in practice. But when it does happen it's confusing, giving
misleading errors or false successes (eg printing timedot entries
instead of a journal error).
For predictability and to minimise confusion, hledger no longer tries
to guess; when there's no file extension or reader prefix, it assumes
journal format. To specify one of the other formats, you must use a
standard file extension (.timeclock, .timedot, .csv, .ssv, .tsv), or a
reader prefix (-f csv:foo.txt, -f timedot:-).
For now, the include directive still tries to autodetect
(journal/timeclock/timedot), and this can't be overridden; it will be
fixed later.
Experimental; testing and feedback welcome.
2020-02-29 20:17:39 +03:00
|
|
|
$ hledger -f timeclock:- print
|
2020-01-12 13:26:30 +03:00
|
|
|
>
|
2019-12-30 08:19:50 +03:00
|
|
|
2009-01-01 * 08:00-09:00
|
2017-06-05 07:26:18 +03:00
|
|
|
() 1.00h
|
2015-04-28 23:54:36 +03:00
|
|
|
|
2019-12-30 08:19:50 +03:00
|
|
|
2009-01-02 * 08:00-09:00
|
2017-06-05 07:26:18 +03:00
|
|
|
(account name) 1.00h
|
2015-04-28 23:54:36 +03:00
|
|
|
|
2019-12-30 08:19:50 +03:00
|
|
|
2009-01-03 * and a description
|
2017-06-05 07:26:18 +03:00
|
|
|
(some:account name) 1.00h
|
2009-12-08 02:29:19 +03:00
|
|
|
|
2020-01-12 13:26:30 +03:00
|
|
|
>2
|
|
|
|
>= 0
|
|
|
|
|
|
|
|
# For a missing clock-out, now is implied
|
|
|
|
<
|
|
|
|
i 2020/1/1 08:00
|
lib: drop the file format auto-detection feature
For a long time hledger has auto-detected the file format when it's
not known, eg when reading from a file with unusual extension (like
.dat or .txt), or from standard input (-f-), or when using the include
directive (which currently ignores file extensions).
Auto-detecting has been done by trying all readers until one succeeds.
This could guess wrong in some cases, but it was so rare that it has
been working fine.
Recently, more conveniences have been added to timedot format,
increasing its overlap with journal format, which makes this kind of
auto-detection unreliable.
Auto-detection and auto-detection failures are (probably) still pretty
rare in practice. But when it does happen it's confusing, giving
misleading errors or false successes (eg printing timedot entries
instead of a journal error).
For predictability and to minimise confusion, hledger no longer tries
to guess; when there's no file extension or reader prefix, it assumes
journal format. To specify one of the other formats, you must use a
standard file extension (.timeclock, .timedot, .csv, .ssv, .tsv), or a
reader prefix (-f csv:foo.txt, -f timedot:-).
For now, the include directive still tries to autodetect
(journal/timeclock/timedot), and this can't be overridden; it will be
fixed later.
Experimental; testing and feedback welcome.
2020-02-29 20:17:39 +03:00
|
|
|
$ hledger -f timeclock:- balance
|
2020-01-12 13:26:30 +03:00
|
|
|
> /./
|
|
|
|
>= 0
|
|
|
|
|
|
|
|
# For a log not starting with clock-out, print error
|
|
|
|
<
|
|
|
|
o 2020/1/1 08:00
|
lib: drop the file format auto-detection feature
For a long time hledger has auto-detected the file format when it's
not known, eg when reading from a file with unusual extension (like
.dat or .txt), or from standard input (-f-), or when using the include
directive (which currently ignores file extensions).
Auto-detecting has been done by trying all readers until one succeeds.
This could guess wrong in some cases, but it was so rare that it has
been working fine.
Recently, more conveniences have been added to timedot format,
increasing its overlap with journal format, which makes this kind of
auto-detection unreliable.
Auto-detection and auto-detection failures are (probably) still pretty
rare in practice. But when it does happen it's confusing, giving
misleading errors or false successes (eg printing timedot entries
instead of a journal error).
For predictability and to minimise confusion, hledger no longer tries
to guess; when there's no file extension or reader prefix, it assumes
journal format. To specify one of the other formats, you must use a
standard file extension (.timeclock, .timedot, .csv, .ssv, .tsv), or a
reader prefix (-f csv:foo.txt, -f timedot:-).
For now, the include directive still tries to autodetect
(journal/timeclock/timedot), and this can't be overridden; it will be
fixed later.
Experimental; testing and feedback welcome.
2020-02-29 20:17:39 +03:00
|
|
|
$ hledger -f timeclock:- balance
|
2020-01-12 13:26:30 +03:00
|
|
|
>2 /line 1: expected timeclock code i/
|
|
|
|
>= !0
|
|
|
|
|
|
|
|
# For a different log starting not with clock-out, print error
|
|
|
|
<
|
|
|
|
o 2020/1/1 08:00
|
|
|
|
o 2020/1/1 09:00
|
lib: drop the file format auto-detection feature
For a long time hledger has auto-detected the file format when it's
not known, eg when reading from a file with unusual extension (like
.dat or .txt), or from standard input (-f-), or when using the include
directive (which currently ignores file extensions).
Auto-detecting has been done by trying all readers until one succeeds.
This could guess wrong in some cases, but it was so rare that it has
been working fine.
Recently, more conveniences have been added to timedot format,
increasing its overlap with journal format, which makes this kind of
auto-detection unreliable.
Auto-detection and auto-detection failures are (probably) still pretty
rare in practice. But when it does happen it's confusing, giving
misleading errors or false successes (eg printing timedot entries
instead of a journal error).
For predictability and to minimise confusion, hledger no longer tries
to guess; when there's no file extension or reader prefix, it assumes
journal format. To specify one of the other formats, you must use a
standard file extension (.timeclock, .timedot, .csv, .ssv, .tsv), or a
reader prefix (-f csv:foo.txt, -f timedot:-).
For now, the include directive still tries to autodetect
(journal/timeclock/timedot), and this can't be overridden; it will be
fixed later.
Experimental; testing and feedback welcome.
2020-02-29 20:17:39 +03:00
|
|
|
$ hledger -f timeclock:- balance
|
2020-01-12 13:26:30 +03:00
|
|
|
>2 /line 1: expected timeclock code i/
|
|
|
|
>= !0
|
|
|
|
|
|
|
|
# For two consecutive clock-in, print error
|
|
|
|
<
|
|
|
|
i 2020/1/1 08:00
|
|
|
|
i 2020/1/1 09:00
|
lib: drop the file format auto-detection feature
For a long time hledger has auto-detected the file format when it's
not known, eg when reading from a file with unusual extension (like
.dat or .txt), or from standard input (-f-), or when using the include
directive (which currently ignores file extensions).
Auto-detecting has been done by trying all readers until one succeeds.
This could guess wrong in some cases, but it was so rare that it has
been working fine.
Recently, more conveniences have been added to timedot format,
increasing its overlap with journal format, which makes this kind of
auto-detection unreliable.
Auto-detection and auto-detection failures are (probably) still pretty
rare in practice. But when it does happen it's confusing, giving
misleading errors or false successes (eg printing timedot entries
instead of a journal error).
For predictability and to minimise confusion, hledger no longer tries
to guess; when there's no file extension or reader prefix, it assumes
journal format. To specify one of the other formats, you must use a
standard file extension (.timeclock, .timedot, .csv, .ssv, .tsv), or a
reader prefix (-f csv:foo.txt, -f timedot:-).
For now, the include directive still tries to autodetect
(journal/timeclock/timedot), and this can't be overridden; it will be
fixed later.
Experimental; testing and feedback welcome.
2020-02-29 20:17:39 +03:00
|
|
|
$ hledger -f timeclock:- balance
|
2020-01-12 13:26:30 +03:00
|
|
|
>2 /line 2: expected timeclock code o/
|
|
|
|
>= !0
|
2011-04-18 21:31:27 +04:00
|
|
|
|
2017-04-26 04:56:38 +03:00
|
|
|
## TODO
|
2020-01-12 13:26:30 +03:00
|
|
|
## multi-day sessions get a new transaction for each day
|
lib: drop the file format auto-detection feature
For a long time hledger has auto-detected the file format when it's
not known, eg when reading from a file with unusual extension (like
.dat or .txt), or from standard input (-f-), or when using the include
directive (which currently ignores file extensions).
Auto-detecting has been done by trying all readers until one succeeds.
This could guess wrong in some cases, but it was so rare that it has
been working fine.
Recently, more conveniences have been added to timedot format,
increasing its overlap with journal format, which makes this kind of
auto-detection unreliable.
Auto-detection and auto-detection failures are (probably) still pretty
rare in practice. But when it does happen it's confusing, giving
misleading errors or false successes (eg printing timedot entries
instead of a journal error).
For predictability and to minimise confusion, hledger no longer tries
to guess; when there's no file extension or reader prefix, it assumes
journal format. To specify one of the other formats, you must use a
standard file extension (.timeclock, .timedot, .csv, .ssv, .tsv), or a
reader prefix (-f csv:foo.txt, -f timedot:-).
For now, the include directive still tries to autodetect
(journal/timeclock/timedot), and this can't be overridden; it will be
fixed later.
Experimental; testing and feedback welcome.
2020-02-29 20:17:39 +03:00
|
|
|
#hledger -ftimeclock:- print
|
2017-04-26 04:56:38 +03:00
|
|
|
#<<<
|
|
|
|
#i 2017/04/20 09:00:00 A
|
|
|
|
#o 2017/04/20 17:00:00
|
|
|
|
#i 2017/04/21 09:00:00 B
|
|
|
|
#o 2017/04/21 17:00:00
|
|
|
|
#i 2017/04/22 09:00:00 C
|
|
|
|
#o 2017/04/22 17:00:00
|
|
|
|
#>>>
|
|
|
|
#>>>2
|
|
|
|
#>>>=
|
|
|
|
#
|
2020-01-12 13:26:30 +03:00
|
|
|
## unclosed sessions are automatically closed at report time
|
2017-04-26 04:56:38 +03:00
|
|
|
## TODO this output looks wrong
|
lib: drop the file format auto-detection feature
For a long time hledger has auto-detected the file format when it's
not known, eg when reading from a file with unusual extension (like
.dat or .txt), or from standard input (-f-), or when using the include
directive (which currently ignores file extensions).
Auto-detecting has been done by trying all readers until one succeeds.
This could guess wrong in some cases, but it was so rare that it has
been working fine.
Recently, more conveniences have been added to timedot format,
increasing its overlap with journal format, which makes this kind of
auto-detection unreliable.
Auto-detection and auto-detection failures are (probably) still pretty
rare in practice. But when it does happen it's confusing, giving
misleading errors or false successes (eg printing timedot entries
instead of a journal error).
For predictability and to minimise confusion, hledger no longer tries
to guess; when there's no file extension or reader prefix, it assumes
journal format. To specify one of the other formats, you must use a
standard file extension (.timeclock, .timedot, .csv, .ssv, .tsv), or a
reader prefix (-f csv:foo.txt, -f timedot:-).
For now, the include directive still tries to autodetect
(journal/timeclock/timedot), and this can't be overridden; it will be
fixed later.
Experimental; testing and feedback welcome.
2020-02-29 20:17:39 +03:00
|
|
|
#hledger -ftimeclock:- print
|
2017-04-26 04:56:38 +03:00
|
|
|
#<<<
|
|
|
|
#i 2017/04/20 09:00:00 A
|
|
|
|
#o 2017/04/20 17:00:00
|
|
|
|
#i 2017/04/21 09:00:00 B
|
|
|
|
#o 2017/04/21 17:00:00
|
|
|
|
#i 2017/04/22 09:00:00 C
|
|
|
|
#o 2017/04/22 17:00:00
|
|
|
|
#>>>
|
2019-12-30 08:19:50 +03:00
|
|
|
#2017-04-20 * 09:00-17:00
|
2017-04-26 04:56:38 +03:00
|
|
|
# (A) 8.00h
|
|
|
|
#
|
2019-12-30 08:19:50 +03:00
|
|
|
#2017-04-21 * 09:00-23:59
|
2017-04-26 04:56:38 +03:00
|
|
|
# (B) 15.00h
|
|
|
|
#
|
2019-12-30 08:19:50 +03:00
|
|
|
#2017-04-22 * 00:00-09:00
|
2017-04-26 04:56:38 +03:00
|
|
|
# (B) 9.00h
|
|
|
|
#
|
2019-12-30 08:19:50 +03:00
|
|
|
#2017-04-22 * 17:00-23:59
|
2017-04-26 04:56:38 +03:00
|
|
|
# () 7.00h
|
|
|
|
#
|
2019-12-30 08:19:50 +03:00
|
|
|
#2017-04-23 * 00:00-23:59
|
2017-04-26 04:56:38 +03:00
|
|
|
# () 24.00h
|
|
|
|
#
|
2019-12-30 08:19:50 +03:00
|
|
|
#2017-04-24 * 00:00-23:59
|
2017-04-26 04:56:38 +03:00
|
|
|
# () 24.00h
|
|
|
|
#
|
2019-12-30 08:19:50 +03:00
|
|
|
#2017-04-25 * 00:00-11:28
|
2017-04-26 04:56:38 +03:00
|
|
|
# () 11.47h
|
|
|
|
#
|
|
|
|
#>>>2
|
|
|
|
#>>>=
|
2017-04-25 22:04:39 +03:00
|
|
|
|
|
|
|
|
2016-04-13 07:10:02 +03:00
|
|
|
# ledger timeclock example from #ledger
|
|
|
|
# ==== consulting.timeclock
|
|
|
|
# ; Time log for consulting sideline
|
2011-04-18 21:31:27 +04:00
|
|
|
# ; All times UTC
|
|
|
|
# i 2011/01/26 16:00:00 XXXX:Remote "IPMI Access"
|
|
|
|
# o 2011/01/26 16:15:00
|
|
|
|
|
|
|
|
# i 2011/01/26 17:45:00 XXXX:Onsite "Fix opty server"
|
|
|
|
# o 2011/01/26 20:00:00
|
|
|
|
|
|
|
|
# i 2011/01/27 18:00:00 XXXX:Remote "SSL certificate for www.YYYY.com"
|
|
|
|
# o 2011/01/27 18:15:00
|
|
|
|
|
|
|
|
# ; vim:ts=2 sw=2 sts=2 et ft=ledger fdm=manual:
|
|
|
|
# ==== consulting.dat
|
|
|
|
# ; Ledger for Consulting sideline
|
|
|
|
|
|
|
|
# !account Consulting
|
2016-04-13 07:10:02 +03:00
|
|
|
# !include consulting.timeclock
|
2011-04-18 21:31:27 +04:00
|
|
|
# !end
|
|
|
|
|
|
|
|
|
|
|
|
# 2010/02/27 (INV#2) XXXX Test Invoice
|
|
|
|
# Consulting:XXXX:Remote -0.5h @ $75.00
|
|
|
|
# Consulting:XXXX:Onsite -2.25h @ $100.00
|
|
|
|
# Receivable:Consulting:XXXX
|
|
|
|
|
|
|
|
|
|
|
|
# ; vim:ts=2 sw=2 sts=2 et ft=ledger fdm=manual:
|
|
|
|
# ==== command: ledger -f consulting.dat -s bal
|
|
|
|
# -2.25h Consulting:XXXX:Onsite
|
|
|
|
# 2.25h Consulting:XXXX:Onsite "Fix opty server"
|
|
|
|
# -30.0m Consulting:XXXX:Remote
|
|
|
|
# 15.0m Consulting:XXXX:Remote "IPMI Access"
|
|
|
|
# 15.0m Consulting:XXXX:Remote "SSL certificate for www.YYYY.com"
|
|
|
|
# $262.5 Receivable:Consulting:XXXX
|
|
|
|
# --------------------
|
|
|
|
# $262.5
|
2019-07-08 10:28:03 +03:00
|
|
|
|
|
|
|
# # timezone-related tests
|
|
|
|
# # 1. as in ledger, historical prices may contain a time and timezone.
|
|
|
|
# # hledger ignores them and uses 00:00 local time instead.
|
|
|
|
# # XXX needs --value not --cost
|
|
|
|
# hledgerdev -f - balance --no-total --cost
|
|
|
|
# <<<
|
|
|
|
# P 2011/01/01 00:00:00 A $1
|
|
|
|
# P 2011/01/01 15:00:00-0100 A $2
|
|
|
|
|
|
|
|
# 2010/12/31
|
|
|
|
# (20101231) 1 A
|
|
|
|
|
|
|
|
# 2011/1/1
|
|
|
|
# (20110101) 1 A
|
|
|
|
|
|
|
|
# 2011/1/2
|
|
|
|
# (20110102) 1 A
|
|
|
|
# >>>
|
|
|
|
# 1 A 20101231
|
|
|
|
# $2 20110101
|
|
|
|
# $2 20110102
|
|
|
|
# >>>=0
|