td-watson 3.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.5
2
+ Name: td-watson
3
+ Version: 3.0.0
4
+ Summary: A wonderful CLI to track your time!
5
+ Project-URL: Repository, https://github.com/jmaupetit/Watson
6
+ Author: William Durand
7
+ Author-email: Yannick Péroux <yannick.peroux@gmail.com>, Julien Maupetit <julien@maupetit.net>, Christopher Arndt <chris@chrisarndt.de>
8
+ Maintainer-email: Julien Maupetit <julien@maupetit.net>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: CLI,monitoring,report,time tracking,time-tracking,watson
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Customer Service
15
+ Classifier: Intended Audience :: End Users/Desktop
16
+ Classifier: Intended Audience :: Information Technology
17
+ Classifier: Intended Audience :: Other Audience
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: Operating System :: MacOS
20
+ Classifier: Operating System :: Microsoft :: Windows
21
+ Classifier: Operating System :: POSIX
22
+ Classifier: Topic :: Office/Business
23
+ Classifier: Topic :: Utilities
24
+ Requires-Python: <4.0.0,>=3.11
25
+ Requires-Dist: arrow>=1.4.0
26
+ Requires-Dist: click-didyoumean>=0.3.1
27
+ Requires-Dist: click>=8.3.1
28
+ Requires-Dist: colorama>=0.4.6
29
+ Requires-Dist: requests>=2.32.5
30
+ Description-Content-Type: text/markdown
31
+
32
+ ![Watson Logo](https://jmaupetit.github.io/Watson/img/logo-watson.svg)
33
+
34
+ ![PyPI - Version](https://img.shields.io/pypi/v/td-watson)
35
+
36
+ Watson is here to help you manage your time. You want to know how much time you
37
+ are spending on your projects? You want to generate a nice report for your
38
+ client? Watson is here for you.
39
+
40
+ Wanna know what it looks like? Check this below.
41
+
42
+ [![Watson demo](https://jmaupetit.github.io/Watson/img/watson-demo.gif)](https://asciinema.org/a/35918)
43
+
44
+ Nice, isn't it?
45
+
46
+ ## Quick start
47
+
48
+ ### Installation
49
+
50
+ The easiest way to install Watson is to use [uv](https://docs.astral.sh/uv/):
51
+
52
+ ```sh
53
+ $ uv tool install td-watson
54
+ ```
55
+
56
+ This will create a Python virtual environment for Watson and a shortcut
57
+ available in your `$PATH`.
58
+
59
+ Alternatively, you may use pip inside a virtual environment:
60
+
61
+ ```sh
62
+ $ pip install td-watson
63
+ ```
64
+
65
+ On macOS, a [Homebrew](https://brew.sh/) formula is also available:
66
+
67
+ ```sh
68
+ $ brew update && brew install watson
69
+ ```
70
+
71
+ If you need more details about installing Watson, please refer to the
72
+ [documentation](https://jmaupetit.github.io/Watson).
73
+
74
+ ### Usage
75
+
76
+ Start tracking your activity via:
77
+
78
+ ```sh
79
+ $ watson start world-domination +cats
80
+ ```
81
+
82
+ With this command, you have started a new **frame** for the *world-domination*
83
+ project with the *cats* tag. That's it.
84
+
85
+ Now stop tracking your world domination plan via:
86
+
87
+ ```sh
88
+ $ watson stop
89
+ Stopping project world-domination [cats], started 8 minutes ago and stopped just now. (id: ffb2a4c)
90
+ ```
91
+
92
+ You can log your latest working sessions (aka *frames*) thanks to the `log`
93
+ command:
94
+
95
+ ```sh
96
+ $ watson log
97
+ Tuesday 26 January 2016 (8m 32s)
98
+ ffb2a4c 13:00 to 13:08 08m 32s world-domination [cats]
99
+ ```
100
+
101
+ Please note that, like the
102
+ [`report` command](https://jmaupetit.github.io/Watson/user-guide/commands/#report),
103
+ the `log` command can filter by project, tag and date.
104
+
105
+ To list all available commands, either [read the
106
+ documentation](https://jmaupetit.github.io/Watson) or use:
107
+
108
+ ```sh
109
+ $ watson help
110
+ ```
111
+
112
+ ## Contributor Code of Conduct
113
+
114
+ If you want to contribute to this project, please read the project [Contributor
115
+ Code of Conduct](https://jmaupetit.github.io/Watson/contributing/coc/).
116
+
117
+ ## License
118
+
119
+ Watson is released under the MIT License. See the bundled LICENSE file for
120
+ details.
@@ -0,0 +1,14 @@
1
+ watson/__init__.py,sha256=uviSeJE7fQhZyhgsgXvt7fjEohbYyjpmoM-DDqpvEs4,117
2
+ watson/__main__.py,sha256=Kw_goCdJH7DssZIHWVtMdh4XBboZQNxJLTVa2ujvwy0,60
3
+ watson/autocompletion.py,sha256=kGIvJ9eA4xYRybVY32BavCRawavKXMKrJpWMHcZKwoM,3914
4
+ watson/cli.py,sha256=eZEyly4h0kn4vJ3WkJ0JBOwSavSSETclm9UtFRF-X2Q,64629
5
+ watson/config.py,sha256=e_R7IsViqDLwYv7z3hgdWOJQ5ps9ejJ_5H94RlmtTO8,3523
6
+ watson/frames.py,sha256=_2nPkJMAXWtzNIzKxLqSMcj4JVJeCy5L5w6wfpVoyp4,6911
7
+ watson/fullmoon.py,sha256=pbINt2943pTdIi_cPhcsYnpfKNuv9IquDMC46aRyqss,20437
8
+ watson/utils.py,sha256=UA6f3EC9p58D40wATWDqFRIUMQvo9s9ejCZBhnpvv20,13248
9
+ watson/watson.py,sha256=-9RuofI4OCdgHu005rqUljlEVJKS7BvctC2CLxc8QjY,19936
10
+ td_watson-3.0.0.dist-info/METADATA,sha256=j2FQWciZL-tBZszb95yF27N5kq1WenffcmUv98sWRKw,3529
11
+ td_watson-3.0.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
12
+ td_watson-3.0.0.dist-info/entry_points.txt,sha256=AlZUPwu4aqzSveY3jj4mIlt1R3OsCzknurTdx_vhJAk,47
13
+ td_watson-3.0.0.dist-info/licenses/LICENSE,sha256=POYITKqwo-oQT1jF15KzovdSr-1NW2lRQnXatAu1s7Y,1111
14
+ td_watson-3.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ watson = watson.__main__:cli
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Tailordev
4
+ Copyright (c) 2026 Julien Maupetit
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
watson/__init__.py ADDED
@@ -0,0 +1,4 @@
1
+ from .watson import __version__ # noqa
2
+ from .watson import Watson, WatsonError
3
+
4
+ __all__ = ["Watson", "WatsonError"]
watson/__main__.py ADDED
@@ -0,0 +1,5 @@
1
+ """Watson entrypoint."""
2
+
3
+ from watson import cli
4
+
5
+ cli.cli()
@@ -0,0 +1,113 @@
1
+ """Watson shell autocompletion helpers."""
2
+
3
+ from .utils import create_watson, parse_tags
4
+
5
+
6
+ def _bypass_click_bug_to_ensure_watson(ctx):
7
+ # When pallets/click#942 is fixed, this won't be needed...
8
+ if ctx.obj is None:
9
+ ctx.obj = create_watson()
10
+ return ctx.obj
11
+
12
+
13
+ def get_project_or_task_completion(ctx, args, incomplete):
14
+ """Function to autocomplete either organisations or tasks.
15
+
16
+ The completion depends on the shape of the current argument.
17
+ """
18
+
19
+ def get_incomplete_tag(args, incomplete):
20
+ """Get incomplete tag from command line string."""
21
+ cmd_line = " ".join(args + [incomplete])
22
+ found_tags = parse_tags(cmd_line)
23
+ return found_tags[-1] if found_tags else ""
24
+
25
+ def fix_broken_tag_parsing(incomplete_tag):
26
+ """Remove spaces from parsed tag.
27
+
28
+ The function `parse_tags` inserts a space after each character. In
29
+ order to obtain the actual command line part, the space needs to be
30
+ removed.
31
+ """
32
+ return "".join(char for char in incomplete_tag.split(" "))
33
+
34
+ def prepend_plus(tag_suggestions):
35
+ """Prepend '+' to each tag suggestion.
36
+
37
+ For the `watson` targeted with the function
38
+ get_project_or_task_completion, a leading plus in front of a tag is
39
+ expected. The get_tags() suggestion generation does not include those
40
+ as it targets other subcommands.
41
+
42
+ In order to not destroy the current tag stub, the plus must be
43
+ pretended.
44
+ """
45
+ for cur_suggestion in tag_suggestions:
46
+ yield "+{cur_suggestion}".format(cur_suggestion=cur_suggestion)
47
+
48
+ _bypass_click_bug_to_ensure_watson(ctx)
49
+
50
+ project_is_completed = any(tok.startswith("+") for tok in args + [incomplete])
51
+ if project_is_completed:
52
+ incomplete_tag = get_incomplete_tag(args, incomplete)
53
+ fixed_incomplete_tag = fix_broken_tag_parsing(incomplete_tag)
54
+ tag_suggestions = get_tags(ctx, args, fixed_incomplete_tag)
55
+ return prepend_plus(tag_suggestions)
56
+ else:
57
+ return get_projects(ctx, args, incomplete)
58
+
59
+
60
+ def get_projects(ctx, args, incomplete):
61
+ """Function to return all projects matching the prefix."""
62
+ watson = _bypass_click_bug_to_ensure_watson(ctx)
63
+ for cur_project in watson.projects:
64
+ if cur_project.startswith(incomplete):
65
+ yield cur_project
66
+
67
+
68
+ def get_rename_name(ctx, args, incomplete):
69
+ """Function to return all projects or tasks matching the prefix.
70
+
71
+ Depending on the specified rename_type, either a list of projects or a list
72
+ of tasks must be returned. This function takes care of this distinction and
73
+ returns the appropriate names.
74
+
75
+ If the passed in type is unknown, e.g. due to a typo, an empty completion
76
+ is generated.
77
+ """
78
+ in_type = ctx.params["rename_type"]
79
+ if in_type == "project":
80
+ return get_projects(ctx, args, incomplete)
81
+ elif in_type == "tag":
82
+ return get_tags(ctx, args, incomplete)
83
+
84
+ return []
85
+
86
+
87
+ def get_rename_types(ctx, args, incomplete):
88
+ """Function to return all rename types matching the prefix."""
89
+ for cur_type in "project", "tag":
90
+ if cur_type.startswith(incomplete):
91
+ yield cur_type
92
+
93
+
94
+ def get_tags(ctx, args, incomplete):
95
+ """Function to return all tags matching the prefix."""
96
+ watson = _bypass_click_bug_to_ensure_watson(ctx)
97
+ for cur_tag in watson.tags:
98
+ if cur_tag.startswith(incomplete):
99
+ yield cur_tag
100
+
101
+
102
+ def get_frames(ctx, args, incomplete):
103
+ """Return all matching frame IDs.
104
+
105
+ This function returns all frame IDs that match the given prefix in a
106
+ generator. If no ID matches the prefix, it returns the empty generator.
107
+ """
108
+ watson = _bypass_click_bug_to_ensure_watson(ctx)
109
+
110
+ for cur_frame in watson.frames:
111
+ yield_candidate = cur_frame.id
112
+ if yield_candidate.startswith(incomplete):
113
+ yield yield_candidate