Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## Added

- The default log length can now be controlled via the configuration option
`log_length`. (#436)

## [2.0.1] - 2021-05-10

### Fixed
Expand Down
5 changes: 5 additions & 0 deletions docs/user-guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ If `true`, the output of the `log` command will include the currently running
frame (if any) by default. The option can be overridden on the command line
with the `-c/-C` resp. `--current/--no-current` flags.

#### `options.log_length` (default: `7`)

The number of previous days to show when running `watson log`.

#### `options.pager` (default: `true`)

If `true`, the output of the `log` and `report` command will be
Expand Down Expand Up @@ -238,6 +242,7 @@ log_current = false
pager = true
report_current = false
reverse_log = true
log_length = 3
```

## Application folder
Expand Down
5 changes: 4 additions & 1 deletion watson/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ def aggregate(ctx, watson, current, from_, to, projects, tags, output_format,
@click.option('-r/-R', '--reverse/--no-reverse', 'reverse', default=None,
help="(Don't) reverse the order of the days in output.")
@click.option('-f', '--from', 'from_', type=DateTime,
default=arrow.now().shift(days=-7),
default=None,
help="The date from when the log should start. Defaults "
"to seven days ago.")
@click.option('-t', '--to', type=DateTime, default=arrow.now(),
Expand Down Expand Up @@ -1022,6 +1022,9 @@ def log(watson, current, reverse, from_, to, projects, tags, ignore_projects,
02cb269,2014-04-16 09:53,2014-04-16 12:43,apollo11,wheels
1070ddb,2014-04-16 13:48,2014-04-16 16:17,voyager1,"antenna, sensors"
""" # noqa
if from_ is None:
log_length = watson.config.getint('options', 'log_length', 7)
from_ = arrow.now().shift(days=-log_length)
for start_time in (_ for _ in [day, week, month, luna, year, all]
if _ is not None):
from_ = start_time
Expand Down