Chart formatter and per-command default formatters

This commit is contained in:
Abraham Toriz 2022-08-31 08:19:16 -04:00
parent 2ed3f84454
commit de1a4a2849
No known key found for this signature in database
GPG Key ID: D5B4A746DB5DD42A
5 changed files with 48 additions and 7 deletions

View File

@ -1,5 +1,14 @@
# Changes
## 1.4.0
- Brand new `chart` formatter that shows your work history
- Fix bash-completions file
- Improve some output messages
- Fix timezone handling (in old databases) for --interactive
- Tell how to silence the timetrap warning as part of the warning :(
- Allow to set per-command default formatters
## 1.3.2
- Sort entries by most recent last in --interactive. Since most of the time you

2
Cargo.lock generated
View File

@ -812,7 +812,7 @@ dependencies = [
[[package]]
name = "tiempo"
version = "1.3.2"
version = "1.4.0"
dependencies = [
"ansi_term 0.12.1",
"atty",

View File

@ -11,7 +11,7 @@ description = "A command line time tracker"
license = "GPL-3.0"
documentation = "https://gitlab.com/categulario/tiempo-rs"
homepage = "https://gitlab.com/categulario/tiempo-rs"
version = "1.3.2"
version = "1.4.0"
[dependencies]
clap = "2"

View File

@ -96,7 +96,7 @@ the available options are
-s, --start <date:qs> Include entries that start on this date or later
-e, --end <date:qs> Include entries that start on this date or earlier
-f, --format <format> The output format. Valid built-in formats are
ical, csv, json, ids, factor, and text (default).
chart, text (default), ical, csv, json and ids.
Check the docs on defining custom formats bellow.
-g, --grep <regexp> Include entries where the note matches this regexp
@ -119,6 +119,36 @@ Some shortcuts available are:
t month [--ids] [--start MONTH] [--format FMT] [SHEET | all]
#### Per command default formatters
**New in 1.4.0**
It might be the case that you want to use one default formatter for when you use
`t week` and a different one for `t month` or `t today`. That's what per-command
default formatters are for. To use them just add a `commands` section to your
config file and set `default_formatter` on some formatters. This is what it
would look like:
**In toml**
```toml
[commands.week]
default_formatter = "chart"
[commands.month]
default_formatter = "ical"
```
**In yaml**
```yaml
commands:
week:
default_formatter: chart
month:
default_formatter: ical
```
### Using different timesheets
You can organize your activities in different timesheets by first switching to
@ -140,7 +170,7 @@ underscore)
You can archive entries from a timesheet using:
t archive [--start DATE] [--end DATE] [SHEET]
t archive [OPTIONS] [SHEET]
which defaults to archiving all entries in the current sheet, or you can be more
specific using these options:
@ -372,6 +402,8 @@ for and whose design I took as reference, keeping compatibility when possible.
(mostly to remind myself)
* [ ] Ensure tests pass and that clippy doesn't complain
* [ ] Create an entry in `CHANGELOG.md` with the target version, stage it
* [ ] Add documentation to the readme on the new features
* [ ] Create an entry in `CHANGELOG.md` with the target version, stage it but
don't commit
* [ ] run `vbump`
* [ ] git push && git push --tags && cargo publish && cargo build --release && cp target/release/t ~/.local/bin/t

View File

@ -104,8 +104,8 @@ fn main() {
.short("f").long("format")
.takes_value(true).value_name("FORMAT")
.help(
"The output format. Valid built-in formats are ical, csv, json, \
ids, and text. Documentation on defining custom formats can be \
"The output format. Valid built-in formats are chart, text, ical, \
csv, json, ids. Documentation on defining custom formats can be \
found at https://gitlab.com/categulario/tiempo"
);