Skip to content

Commit fab6127

Browse files
aero31aeroprat0088
andcommitted
Add 'notes' field to frames.
This is a large commit that adds the following: 1. Syntax: `watson stop --notes "some additional information"`. 2. Print only non-empty notes in log. 3. Always pass id to `new_frame` so that the length of array with/without notes doesn't cause ambiguity. 4. Print a warning message and the existing note if overwriting a note. 5. Print notes in report. Co-authored-by: Tristan Pratt <[email protected]> Co-authored-by: Rohitt Vashishtha <[email protected]>
1 parent 560e962 commit fab6127

22 files changed

+521
-320
lines changed

.travis.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ matrix:
66
os: linux
77
dist: xenial
88
env: TOXENV=flake8
9+
- python: 2.7
10+
os: linux
11+
dist: trusty
12+
env: TOXENV=py27
913
- python: 3.5
1014
os: linux
1115
dist: trusty
@@ -18,14 +22,6 @@ matrix:
1822
os: linux
1923
dist: xenial
2024
env: TOXENV=py37
21-
- python: 3.8
22-
os: linux
23-
dist: xenial
24-
env: TOXENV=py38
25-
- python: 3.9
26-
os: linux
27-
dist: xenial
28-
env: TOXENV=py39
2925

3026
install:
3127
- pip install tox

CHANGELOG.md

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12-
- The `log` command output can now be filtered to exclude projects and tags via `--ignore-project` and `--ignore-tag` (#395)
13-
- Python 3.8 support (#402)
14-
- Python 3.9 support (#402)
15-
16-
### Removed
17-
18-
- Python 2.7 support (#305).
19-
20-
## [1.10.0] - 2020-07-03
21-
22-
### Added
23-
2412
- Log output order can now be controlled via the `--reverse/--no-reverse` flag
2513
and the `reverse_log` configuration option (#369)
2614
- Add `--at` flag to the `start` and `restart` commands (#364).
27-
- Add `--color` and `--no-color` flags to force output to be colored or not
28-
respectively (#350).
2915

3016
### Changed
3117

3218
- Require latest Arrow version 0.15.6 to support ISO week dates (#380)
3319

34-
### Fixed
35-
36-
- Make after-edit-check ensure that edited time stamps are not in the future
37-
(#381)
38-
3920
## [1.9.0] - 2020-05-27
4021

4122
### Added
@@ -260,8 +241,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
260241

261242
First stable public release 🎉
262243

263-
[unreleased]: https://github.com/tailordev/watson/compare/1.10.0...HEAD
264-
[1.10.0]: https://github.com/tailordev/watson/compare/1.9.0...1.10.0
244+
[unreleased]: https://github.com/tailordev/watson/compare/1.9.0...HEAD
265245
[1.9.0]: https://github.com/tailordev/watson/compare/1.8.0...1.9.0
266246
[1.8.0]: https://github.com/tailordev/watson/compare/1.7.0...1.8.0
267247
[1.7.0]: https://github.com/tailordev/watson/compare/1.6.0...1.7.0

README.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,12 @@ On OS X, the easiest way to install **watson** is using `Homebrew <http://brew.s
2424
2525
$ brew update && brew install watson
2626
27-
On other platforms, install **watson** using pip or pip3, depending on which one is available:
27+
On other platforms, install **watson** using pip:
2828

2929
.. code:: bash
3030
3131
$ pip install td-watson
3232
33-
or:
34-
35-
.. code:: bash
36-
37-
$ pip3 install td-watson
38-
3933
If you need more details about installing watson, please refer to the `documentation <https://tailordev.github.io/Watson>`_.
4034

4135
Usage

docs/about/release-notes.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,6 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [1.10.0] - 2020-07-03
9-
10-
### Added
11-
12-
- Log output order can now be controlled via the `--reverse/--no-reverse` flag
13-
and the `reverse_log` configuration option (#369)
14-
- Add `--at` flag to the `start` and `restart` commands (#364).
15-
- Add `--color` and `--no-color` flags to force output to be colored or not
16-
respectively (#350).
17-
18-
### Changed
19-
20-
- Require latest Arrow version 0.15.6 to support ISO week dates (#380)
21-
22-
### Fixed
23-
24-
- Make after-edit-check ensure that edited time stamps are not in the future
25-
(#381)
26-
278
## [1.9.0] - 2020-05-27
289

2910
### Added
@@ -247,7 +228,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
247228

248229
First stable public release 🎉
249230

250-
[1.10.0]: https://github.com/tailordev/watson/compare/1.9.0...1.10.0
251231
[1.9.0]: https://github.com/tailordev/watson/compare/1.8.0...1.9.0
252232
[1.8.0]: https://github.com/tailordev/watson/compare/1.7.0...1.8.0
253233
[1.7.0]: https://github.com/tailordev/watson/compare/1.6.0...1.7.0

docs/user-guide/commands.md

Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Usage: watson add [OPTIONS] [ARGS]...
1313
```
1414

15-
Add time to a project with tag(s) that was not tracked live.
15+
Add time for project with tag(s) that was not tracked live.
1616

1717
Example:
1818

@@ -24,8 +24,8 @@ Example:
2424

2525
Flag | Help
2626
-----|-----
27-
`-f, --from DATETIME` | Date and time of start of tracked activity [required]
28-
`-t, --to DATETIME` | Date and time of end of tracked activity [required]
27+
`-f, --from DATE` | Date and time of start of tracked activity [required]
28+
`-t, --to DATE` | Date and time of end of tracked activity [required]
2929
`-c, --confirm-new-project` | Confirm addition of new project.
3030
`-b, --confirm-new-tag` | Confirm creation of new tag.
3131
`--help` | Show this message and exit.
@@ -53,7 +53,7 @@ If you are outputting to the terminal, you can selectively enable a pager
5353
through the `--pager` option.
5454

5555
You can change the output format from *plain text* to *JSON* using the
56-
`--json` option or to *CSV* using the `--csv` option. Only one of these
56+
`--json` option or to *CSV* using the `--csv` option. Only one of these
5757
two options can be used at once.
5858

5959

@@ -109,8 +109,8 @@ Example:
109109
Flag | Help
110110
-----|-----
111111
`-c, --current / -C, --no-current` | (Don't) include currently running frame in report.
112-
`-f, --from DATETIME` | The date from when the report should start. Defaults to seven days ago.
113-
`-t, --to DATETIME` | The date at which the report should stop (inclusive). Defaults to tomorrow.
112+
`-f, --from DATE` | The date from when the report should start. Defaults to seven days ago.
113+
`-t, --to DATE` | The date at which the report should stop (inclusive). Defaults to tomorrow.
114114
`-p, --project TEXT` | Reports activity only for the given project. You can add other projects by using this option several times.
115115
`-T, --tag TEXT` | Reports activity only for frames containing the given tag. You can add several tags by using this option multiple times
116116
`-j, --json` | Format output in JSON instead of plain text
@@ -141,8 +141,8 @@ Usage: watson config [OPTIONS] SECTION.OPTION [VALUE]
141141

142142
Get and set configuration options.
143143

144-
If `value` is not provided, the content of the `key` is displayed. Else,
145-
the given `value` is set.
144+
If value is not provided, the content of the key is displayed. Else,
145+
the given value is set.
146146

147147
You can edit the config file with an editor with the `--edit` option.
148148

@@ -172,12 +172,12 @@ You can specify the frame to edit by its position or by its frame id.
172172
For example, to edit the second-to-last frame, pass `-2` as the frame
173173
index. You can get the id of a frame with the `watson log` command.
174174

175-
If no id or index is given, the frame defaults to the current frame (or the
176-
last recorded frame, if no project is currently running).
175+
If no id or index is given, the frame defaults to the current frame or the
176+
last recorded frame, if no project is currently running.
177177

178178
The editor used is determined by the `VISUAL` or `EDITOR` environment
179179
variables (in that order) and defaults to `notepad` on Windows systems and
180-
to `vim`, `nano`, or `vi` (first one found) on all other systems.
180+
to `vim`, `nano` or `vi` (first one found) on all other systems.
181181

182182
### Options
183183

@@ -237,22 +237,21 @@ can be controlled with the `--from` and `--to` arguments. The dates
237237
must have the format `YEAR-MONTH-DAY`, like: `2014-05-19`.
238238

239239
You can also use special shortcut options for easier timespan control:
240-
`--day` sets the log timespan to the current day (beginning at `00:00h`)
241-
and `--year`, `--month` and `--week` to the current year, month, or week,
240+
`--day` sets the log timespan to the current day (beginning at 00:00h)
241+
and `--year`, `--month` and `--week` to the current year, month or week
242242
respectively.
243243
The shortcut `--luna` sets the timespan to the current moon cycle with
244244
the last full moon marking the start of the cycle.
245245

246246
If you are outputting to the terminal, you can selectively enable a pager
247247
through the `--pager` option.
248248

249-
You can limit the log to a project or a tag using the `--project`,
250-
`--tag`, `--ignore-project` and `--ignore-tag` options. They can be
251-
specified several times each to add or ignore multiple projects or
252-
tags in the log.
249+
You can limit the log to a project or a tag using the `--project` and
250+
`--tag` options. They can be specified several times each to add multiple
251+
projects or tags to the log.
253252

254253
You can change the output format from *plain text* to *JSON* using the
255-
`--json` option or to *CSV* using the `--csv` option. Only one of these
254+
`--json` option or to *CSV* using the `--csv` option. Only one of these
256255
two options can be used at once.
257256

258257
Example:
@@ -297,9 +296,8 @@ Example:
297296
Flag | Help
298297
-----|-----
299298
`-c, --current / -C, --no-current` | (Don't) include currently running frame in output.
300-
`-r, --reverse / -R, --no-reverse` | (Don't) reverse the order of the days in output.
301-
`-f, --from DATETIME` | The date from when the log should start. Defaults to seven days ago.
302-
`-t, --to DATETIME` | The date at which the log should stop (inclusive). Defaults to tomorrow.
299+
`-f, --from DATE` | The date from when the log should start. Defaults to seven days ago.
300+
`-t, --to DATE` | The date at which the log should stop (inclusive). Defaults to tomorrow.
303301
`-y, --year` | Reports activity for the current year.
304302
`-m, --month` | Reports activity for the current month.
305303
`-l, --luna` | Reports activity for the current moon cycle.
@@ -308,8 +306,6 @@ Flag | Help
308306
`-a, --all` | Reports all activities.
309307
`-p, --project TEXT` | Logs activity only for the given project. You can add other projects by using this option several times.
310308
`-T, --tag TEXT` | Logs activity only for frames containing the given tag. You can add several tags by using this option multiple times
311-
`--ignore-project TEXT` | Logs activity for all projects but the given ones. You can ignore several projects by using the option multiple times. Any given project will be ignored
312-
`--ignore-tag TEXT` | Logs activity for all tags but the given ones. You can ignore several tags by using the option multiple times. Any given tag will be ignored
313309
`-j, --json` | Format output in JSON instead of plain text
314310
`-s, --csv` | Format output in CSV instead of plain text
315311
`-g, --pager / -G, --no-pager` | (Don't) view output through a pager.
@@ -460,8 +456,8 @@ can be controlled with the `--from` and `--to` arguments. The dates
460456
must have the format `YEAR-MONTH-DAY`, like: `2014-05-19`.
461457

462458
You can also use special shortcut options for easier timespan control:
463-
`--day` sets the report timespan to the current day (beginning at `00:00h`)
464-
and `--year`, `--month` and `--week` to the current year, month, or week,
459+
`--day` sets the report timespan to the current day (beginning at 00:00h)
460+
and `--year`, `--month` and `--week` to the current year, month or week
465461
respectively.
466462
The shortcut `--luna` sets the timespan to the current moon cycle with
467463
the last full moon marking the start of the cycle.
@@ -559,8 +555,8 @@ Example:
559555
Flag | Help
560556
-----|-----
561557
`-c, --current / -C, --no-current` | (Don't) include currently running frame in report.
562-
`-f, --from DATETIME` | The date from when the report should start. Defaults to seven days ago.
563-
`-t, --to DATETIME` | The date at which the report should stop (inclusive). Defaults to tomorrow.
558+
`-f, --from DATE` | The date from when the report should start. Defaults to seven days ago.
559+
`-t, --to DATE` | The date at which the report should stop (inclusive). Defaults to tomorrow.
564560
`-y, --year` | Reports activity for the current year.
565561
`-m, --month` | Reports activity for the current month.
566562
`-l, --luna` | Reports activity for the current moon cycle.
@@ -589,9 +585,9 @@ restarted, using the same tags as recorded in that frame. You can specify
589585
the frame to use with an integer frame index argument or a frame ID. For
590586
example, to restart the second-to-last frame, pass `-2` as the frame index.
591587

592-
Normally, if a project is currently started, Watson will print an error and
588+
Normally, if a project is currently started, watson will print an error and
593589
do nothing. If you set the configuration option `options.stop_on_restart`
594-
to a true value (`1`, `on`, `true`, or `yes`), the current project, if any,
590+
to a true value (`1`, `on`, `true` or `yes`), the current project, if any,
595591
will be stopped before the new frame is started. You can pass the option
596592
`-s` or `--stop` resp. `-S` or `--no-stop` to override the default or
597593
configured behaviour.
@@ -613,7 +609,6 @@ Example:
613609

614610
Flag | Help
615611
-----|-----
616-
`--at DATETIME` | Start frame at this time. Must be in (YYYY-MM-DDT)?HH:MM(:SS)? format.
617612
`-s, --stop / -S, --no-stop` | (Don't) Stop an already running project.
618613
`--help` | Show this message and exit.
619614

@@ -628,20 +623,10 @@ You can add tags indicating more specifically what you are working on with
628623
`+tag`.
629624

630625
If there is already a running project and the configuration option
631-
`options.stop_on_start` is set to a true value (`1`, `on`, `true`, or
626+
`options.stop_on_start` is set to a true value (`1`, `on`, `true` or
632627
`yes`), it is stopped before the new project is started.
633628

634-
If `--at` option is given, the provided starting time is used. The
635-
specified time must be after the end of the previous frame and must not be
636-
in the future.
637-
638-
Example:
639-
640-
641-
$ watson start --at 13:37
642-
Starting project apollo11 at 13:37
643-
644-
If the `--no-gap` flag is given, the start time of the new project is set
629+
If the '--no-gap' flag is given, the start time of the new project is set
645630
to the stop time of the most recently stopped project.
646631

647632
Example:
@@ -654,7 +639,6 @@ Example:
654639

655640
Flag | Help
656641
-----|-----
657-
`--at DATETIME` | Start frame at this time. Must be in (YYYY-MM-DDT)?HH:MM(:SS)? format.
658642
`-g, --gap / -G, --no-gap` | (Don't) leave gap between end time of previous project and start time of the current.
659643
`-c, --confirm-new-project` | Confirm addition of new project.
660644
`-b, --confirm-new-tag` | Confirm creation of new tag.
@@ -701,21 +685,27 @@ Usage: watson stop [OPTIONS]
701685

702686
Stop monitoring time for the current project.
703687

704-
If `--at` option is given, the provided stopping time is used. The
705-
specified time must be after the beginning of the to-be-ended frame and must
688+
If '--at' option is given, the provided stopping time is used. The
689+
specified time must be after the begin of the to be ended frame and must
706690
not be in the future.
707691

708-
Example:
692+
You can optionally pass a log message to be saved with the frame via
693+
the ``-n/--note`` option.
709694

695+
Example:
710696

711697
$ watson stop --at 13:37
712698
Stopping project apollo11, started an hour ago and stopped 30 minutes ago. (id: e9ccd52) # noqa: E501
699+
$ watson stop -n "Done some thinking"
700+
Stopping project apollo11, started a minute ago. (id: e7ccd52)
701+
Log message: Done some thinking
713702

714703
### Options
715704

716705
Flag | Help
717706
-----|-----
718-
`--at DATETIME` | Stop frame at this time. Must be in (YYYY-MM-DDT)?HH:MM(:SS)? format.
707+
`--at TIME` | Stop frame at this time. Must be in (YYYY-MM-DDT)?HH:MM(:SS)? format.
708+
`-n, --note TEXT` | Save given log message with the project frame.
719709
`--help` | Show this message and exit.
720710

721711
## `sync`

docs/user-guide/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Watson configuration and data are stored inside your user's application folder.
88
* **Windows**: `%appdata%\watson\config`, which usually expands to `C:\Users\<user>\AppData\Roaming\watson\config`
99
* **Linux**: `~/.config/watson/config`
1010

11-
The configuration file is a typical [python configuration (INI) file](https://docs.python.org/3.9/library/configparser.html#supported-ini-file-structure), that looks like:
11+
The configuration file is a typical [python configuration (INI) file](https://docs.python.org/3.7/library/configparser.html#supported-ini-file-structure), that looks like:
1212

1313
```ini
1414
[Simple Values]
@@ -55,7 +55,7 @@ empty string value here =
5555
# Did I mention we can indent comments, too?
5656
```
5757

58-
_This example configuration file has been taken from the [official python documentation](https://docs.python.org/3.9/library/configparser.html#supported-ini-file-structure)._
58+
_This example configuration file has been taken from the [official python documentation](https://docs.python.org/3.7/library/configparser.html#supported-ini-file-structure)._
5959

6060

6161
## Editing

scripts/fuzzer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
23

34
import arrow
45
import random

scripts/gen-cli-docs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
23

34
import inspect
45

0 commit comments

Comments
 (0)