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 # 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 ## 1.3.2
- Sort entries by most recent last in --interactive. Since most of the time you - 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]] [[package]]
name = "tiempo" name = "tiempo"
version = "1.3.2" version = "1.4.0"
dependencies = [ dependencies = [
"ansi_term 0.12.1", "ansi_term 0.12.1",
"atty", "atty",

View File

@ -11,7 +11,7 @@ description = "A command line time tracker"
license = "GPL-3.0" license = "GPL-3.0"
documentation = "https://gitlab.com/categulario/tiempo-rs" documentation = "https://gitlab.com/categulario/tiempo-rs"
homepage = "https://gitlab.com/categulario/tiempo-rs" homepage = "https://gitlab.com/categulario/tiempo-rs"
version = "1.3.2" version = "1.4.0"
[dependencies] [dependencies]
clap = "2" 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 -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 -e, --end <date:qs> Include entries that start on this date or earlier
-f, --format <format> The output format. Valid built-in formats are -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. Check the docs on defining custom formats bellow.
-g, --grep <regexp> Include entries where the note matches this regexp -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] 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 ### Using different timesheets
You can organize your activities in different timesheets by first switching to 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: 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 which defaults to archiving all entries in the current sheet, or you can be more
specific using these options: specific using these options:
@ -372,6 +402,8 @@ for and whose design I took as reference, keeping compatibility when possible.
(mostly to remind myself) (mostly to remind myself)
* [ ] Ensure tests pass and that clippy doesn't complain * [ ] 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` * [ ] run `vbump`
* [ ] git push && git push --tags && cargo publish && cargo build --release && cp target/release/t ~/.local/bin/t * [ ] 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") .short("f").long("format")
.takes_value(true).value_name("FORMAT") .takes_value(true).value_name("FORMAT")
.help( .help(
"The output format. Valid built-in formats are ical, csv, json, \ "The output format. Valid built-in formats are chart, text, ical, \
ids, and text. Documentation on defining custom formats can be \ csv, json, ids. Documentation on defining custom formats can be \
found at https://gitlab.com/categulario/tiempo" found at https://gitlab.com/categulario/tiempo"
); );