take-note-cli 1.2.1__tar.gz → 2.0.0__tar.gz
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.
- {take_note_cli-1.2.1 → take_note_cli-2.0.0}/PKG-INFO +31 -8
- {take_note_cli-1.2.1 → take_note_cli-2.0.0}/README.md +29 -7
- {take_note_cli-1.2.1 → take_note_cli-2.0.0}/pyproject.toml +2 -1
- take_note_cli-2.0.0/src/take_note_cli/config/config.yaml +6 -0
- {take_note_cli-1.2.1 → take_note_cli-2.0.0}/src/take_note_cli/core/notes.py +25 -11
- {take_note_cli-1.2.1 → take_note_cli-2.0.0}/src/take_note_cli/utils/args.py +1 -6
- take_note_cli-2.0.0/src/take_note_cli/utils/config.py +42 -0
- {take_note_cli-1.2.1 → take_note_cli-2.0.0}/LICENSE +0 -0
- {take_note_cli-1.2.1 → take_note_cli-2.0.0}/src/take_note_cli/__init__.py +0 -0
- {take_note_cli-1.2.1 → take_note_cli-2.0.0}/src/take_note_cli/__main__.py +0 -0
- {take_note_cli-1.2.1 → take_note_cli-2.0.0}/src/take_note_cli/core/__init__.py +0 -0
- {take_note_cli-1.2.1 → take_note_cli-2.0.0}/src/take_note_cli/utils/__init__.py +0 -0
- {take_note_cli-1.2.1 → take_note_cli-2.0.0}/src/take_note_cli/utils/dates.py +0 -0
- {take_note_cli-1.2.1 → take_note_cli-2.0.0}/src/take_note_cli/utils/paths.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: take-note-cli
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: Create and open notes in your favourite editor.
|
|
5
5
|
Home-page: https://github.com/wsinned/take-note
|
|
6
6
|
License: MIT
|
|
@@ -21,27 +21,33 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
23
|
Classifier: Topic :: Utilities
|
|
24
|
+
Requires-Dist: confuse (>=2.0,<3.0)
|
|
24
25
|
Project-URL: Repository, https://github.com/wsinned/take-note
|
|
25
26
|
Description-Content-Type: text/markdown
|
|
26
27
|
|
|
27
28
|
# Take Note
|
|
28
29
|
|
|
29
|
-
**Create and open notes in your favourite editor.**
|
|
30
|
+
**Create, organise and open notes in your favourite editor.**
|
|
31
|
+
|
|
32
|
+
I like having a quick, reliable and repeatable way of taking notes. If I have to open an editor, nvigate to the correct file, or create one in the correct place when it doesn't exist, then I find that I end up taking notes in random places. With Take Note, I have a few simple aliases set up so that typing thisWeek in my shell gets me to the right place in my DropBox with a new file if needed, created from a template so that eveything is consistent. This really scratches my itch. If it works for you great! If not, create your own solution.
|
|
30
33
|
|
|
31
34
|
## Features
|
|
32
35
|
|
|
33
|
-
- Written in Python with
|
|
34
|
-
- Works on Python 3.8 - 3.
|
|
36
|
+
- Written in Python with minimal runtime dependencies. Initially there were none, but I recently added Confuse (in v2.0.0) to allow a config file to do some of the heavy lifting that made aliases cumbersome.
|
|
37
|
+
- Works on Python 3.8 - 3.12.
|
|
35
38
|
- Open notes files for specified week using the `code` command line for VS Code.
|
|
36
39
|
- --thisWeek, --lastWeek and --nextWeek are supported.
|
|
37
40
|
- Organises notes in a date based folder structure from your root notes folder, e.g. 2023/08
|
|
38
|
-
- The default folder is $HOME/Notes
|
|
41
|
+
- The default folder is $HOME/Notes. I prefer to keep them in Google Drive or DropBox so I can access from mobile, tablet or my spare laptop.
|
|
39
42
|
- set the root notes folder using --notesFolder
|
|
40
43
|
- Choose which editor to use with --editor
|
|
41
44
|
- Specify a VS Code workspace to open along with the note file with --workspace
|
|
42
|
-
- This will override the --editor setting to `code
|
|
45
|
+
- This will automatically override the --editor setting to `code`. I have my default workspace set up with:
|
|
46
|
+
- Zen mode
|
|
47
|
+
- Word wrap
|
|
43
48
|
- Specify a template file relative to the root notes folder to use when a new file is created using --template. This also performs a simple replacement of the text HEADER_DATE with the date formatted as "%A %d %B %Y" to use in the document title.
|
|
44
49
|
- Support for batch creation of files in advance. This is useful if you use a device where you can edit files, but can't easily create them. Use --batch 5 along with any of the --*Week options to create that week and the following 4 weeks too.
|
|
50
|
+
- Config file allows base options to be set and reduce command line arguments needed.
|
|
45
51
|
|
|
46
52
|
## Future features
|
|
47
53
|
|
|
@@ -63,9 +69,23 @@ pipx install git+https://github.com/wsinned/take-note
|
|
|
63
69
|
|
|
64
70
|
## Usage
|
|
65
71
|
|
|
72
|
+
### Config File
|
|
73
|
+
|
|
74
|
+
A basic config file will be created in ~/.config/TakeNote/config.yaml if it doesn't already exist. Specifying default values here simplifies use of the command line by reducing the number of options needed to be supplied or added to an alias.
|
|
75
|
+
|
|
76
|
+
#### Config File Default Options
|
|
77
|
+
|
|
78
|
+
- notesFolder: Notes
|
|
79
|
+
- editor: code
|
|
80
|
+
- workspace:
|
|
81
|
+
- template:
|
|
82
|
+
- batch:
|
|
83
|
+
- verbose: False
|
|
84
|
+
|
|
66
85
|
### Command Line
|
|
67
86
|
|
|
68
|
-
|
|
87
|
+
Command line arguments will override any specified in the config file.
|
|
88
|
+
Specify a folder using the --notesFolder option.
|
|
69
89
|
A week option must be supplied from --thisWeek, --lastWeek or --nextWeek
|
|
70
90
|
|
|
71
91
|
```bash
|
|
@@ -137,6 +157,9 @@ ruff . --config pyproject.toml
|
|
|
137
157
|
# run the tests without activating a shell
|
|
138
158
|
poetry run pytest
|
|
139
159
|
|
|
160
|
+
# run the installed app
|
|
161
|
+
poetry run take-note-cli --thisWeek
|
|
162
|
+
|
|
140
163
|
# exit the shell
|
|
141
164
|
exit
|
|
142
165
|
```
|
|
@@ -153,7 +176,7 @@ poetry run ruff . --config pyproject.toml
|
|
|
153
176
|
|
|
154
177
|
From an installed and tested venv, do the following:
|
|
155
178
|
|
|
156
|
-
Bump the version
|
|
179
|
+
Bump the version in pyproject.toml
|
|
157
180
|
|
|
158
181
|
```bash
|
|
159
182
|
# build the package
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
# Take Note
|
|
2
2
|
|
|
3
|
-
**Create and open notes in your favourite editor.**
|
|
3
|
+
**Create, organise and open notes in your favourite editor.**
|
|
4
|
+
|
|
5
|
+
I like having a quick, reliable and repeatable way of taking notes. If I have to open an editor, nvigate to the correct file, or create one in the correct place when it doesn't exist, then I find that I end up taking notes in random places. With Take Note, I have a few simple aliases set up so that typing thisWeek in my shell gets me to the right place in my DropBox with a new file if needed, created from a template so that eveything is consistent. This really scratches my itch. If it works for you great! If not, create your own solution.
|
|
4
6
|
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
|
-
- Written in Python with
|
|
8
|
-
- Works on Python 3.8 - 3.
|
|
9
|
+
- Written in Python with minimal runtime dependencies. Initially there were none, but I recently added Confuse (in v2.0.0) to allow a config file to do some of the heavy lifting that made aliases cumbersome.
|
|
10
|
+
- Works on Python 3.8 - 3.12.
|
|
9
11
|
- Open notes files for specified week using the `code` command line for VS Code.
|
|
10
12
|
- --thisWeek, --lastWeek and --nextWeek are supported.
|
|
11
13
|
- Organises notes in a date based folder structure from your root notes folder, e.g. 2023/08
|
|
12
|
-
- The default folder is $HOME/Notes
|
|
14
|
+
- The default folder is $HOME/Notes. I prefer to keep them in Google Drive or DropBox so I can access from mobile, tablet or my spare laptop.
|
|
13
15
|
- set the root notes folder using --notesFolder
|
|
14
16
|
- Choose which editor to use with --editor
|
|
15
17
|
- Specify a VS Code workspace to open along with the note file with --workspace
|
|
16
|
-
- This will override the --editor setting to `code
|
|
18
|
+
- This will automatically override the --editor setting to `code`. I have my default workspace set up with:
|
|
19
|
+
- Zen mode
|
|
20
|
+
- Word wrap
|
|
17
21
|
- Specify a template file relative to the root notes folder to use when a new file is created using --template. This also performs a simple replacement of the text HEADER_DATE with the date formatted as "%A %d %B %Y" to use in the document title.
|
|
18
22
|
- Support for batch creation of files in advance. This is useful if you use a device where you can edit files, but can't easily create them. Use --batch 5 along with any of the --*Week options to create that week and the following 4 weeks too.
|
|
23
|
+
- Config file allows base options to be set and reduce command line arguments needed.
|
|
19
24
|
|
|
20
25
|
## Future features
|
|
21
26
|
|
|
@@ -37,9 +42,23 @@ pipx install git+https://github.com/wsinned/take-note
|
|
|
37
42
|
|
|
38
43
|
## Usage
|
|
39
44
|
|
|
45
|
+
### Config File
|
|
46
|
+
|
|
47
|
+
A basic config file will be created in ~/.config/TakeNote/config.yaml if it doesn't already exist. Specifying default values here simplifies use of the command line by reducing the number of options needed to be supplied or added to an alias.
|
|
48
|
+
|
|
49
|
+
#### Config File Default Options
|
|
50
|
+
|
|
51
|
+
- notesFolder: Notes
|
|
52
|
+
- editor: code
|
|
53
|
+
- workspace:
|
|
54
|
+
- template:
|
|
55
|
+
- batch:
|
|
56
|
+
- verbose: False
|
|
57
|
+
|
|
40
58
|
### Command Line
|
|
41
59
|
|
|
42
|
-
|
|
60
|
+
Command line arguments will override any specified in the config file.
|
|
61
|
+
Specify a folder using the --notesFolder option.
|
|
43
62
|
A week option must be supplied from --thisWeek, --lastWeek or --nextWeek
|
|
44
63
|
|
|
45
64
|
```bash
|
|
@@ -111,6 +130,9 @@ ruff . --config pyproject.toml
|
|
|
111
130
|
# run the tests without activating a shell
|
|
112
131
|
poetry run pytest
|
|
113
132
|
|
|
133
|
+
# run the installed app
|
|
134
|
+
poetry run take-note-cli --thisWeek
|
|
135
|
+
|
|
114
136
|
# exit the shell
|
|
115
137
|
exit
|
|
116
138
|
```
|
|
@@ -127,7 +149,7 @@ poetry run ruff . --config pyproject.toml
|
|
|
127
149
|
|
|
128
150
|
From an installed and tested venv, do the following:
|
|
129
151
|
|
|
130
|
-
Bump the version
|
|
152
|
+
Bump the version in pyproject.toml
|
|
131
153
|
|
|
132
154
|
```bash
|
|
133
155
|
# build the package
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "take-note-cli"
|
|
3
|
-
version = "
|
|
3
|
+
version = "2.0.0"
|
|
4
4
|
description = "Create and open notes in your favourite editor."
|
|
5
5
|
license = "MIT"
|
|
6
6
|
authors = [
|
|
@@ -27,6 +27,7 @@ packages = [
|
|
|
27
27
|
|
|
28
28
|
[tool.poetry.dependencies]
|
|
29
29
|
python = "^3.8"
|
|
30
|
+
confuse = "^2.0"
|
|
30
31
|
|
|
31
32
|
[tool.poetry.group.dev.dependencies]
|
|
32
33
|
pytest = "^7.4.3"
|
|
@@ -12,6 +12,7 @@ from take_note_cli.utils.dates import (
|
|
|
12
12
|
get_weeks_delta,
|
|
13
13
|
)
|
|
14
14
|
from take_note_cli.utils.args import process_args
|
|
15
|
+
from take_note_cli.utils.config import process_config
|
|
15
16
|
from subprocess import call
|
|
16
17
|
|
|
17
18
|
|
|
@@ -48,22 +49,26 @@ def get_path_for_file(week: date, folder_path):
|
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
def create_batch_of_files(options, week, template_path):
|
|
52
|
+
verbose = options["verbose"]
|
|
53
|
+
batch = options["batch"]
|
|
54
|
+
notesFolder = options["notesFolder"]
|
|
51
55
|
initial_note_path = None
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
|
|
57
|
+
if batch is not None:
|
|
58
|
+
for i in range(batch):
|
|
54
59
|
batch_week = week + get_weeks_delta(i)
|
|
55
|
-
note_path, file_exists = get_path_for_file(batch_week,
|
|
60
|
+
note_path, file_exists = get_path_for_file(batch_week, notesFolder)
|
|
56
61
|
if i == 0:
|
|
57
62
|
initial_note_path = note_path
|
|
58
63
|
|
|
59
64
|
if not file_exists:
|
|
60
|
-
if
|
|
65
|
+
if verbose:
|
|
61
66
|
print(f"Creating file: {note_path}")
|
|
62
67
|
create_file(note_path, template_path, batch_week)
|
|
63
68
|
else:
|
|
64
|
-
initial_note_path, file_exists = get_path_for_file(week,
|
|
69
|
+
initial_note_path, file_exists = get_path_for_file(week, notesFolder)
|
|
65
70
|
if not file_exists:
|
|
66
|
-
if
|
|
71
|
+
if verbose:
|
|
67
72
|
print(f"Creating file: {initial_note_path}")
|
|
68
73
|
create_file(initial_note_path, template_path, week)
|
|
69
74
|
|
|
@@ -84,17 +89,26 @@ def open_file(folder_path, editor, note_file, verbose, workspace=None):
|
|
|
84
89
|
def main(argv):
|
|
85
90
|
template_path = None
|
|
86
91
|
options, parser = process_args(argv)
|
|
92
|
+
config = process_config(options)
|
|
87
93
|
|
|
88
|
-
if
|
|
94
|
+
if config["verbose"]:
|
|
89
95
|
print("Welcome to take-note-cli")
|
|
90
96
|
print(options)
|
|
91
97
|
|
|
92
98
|
delta = calculate_week_offset(options, parser)
|
|
93
99
|
week = get_monday(date.today()) + delta
|
|
94
100
|
|
|
95
|
-
if
|
|
96
|
-
template_path = generate_template_path(
|
|
101
|
+
if config["template"] is not None:
|
|
102
|
+
template_path = generate_template_path(
|
|
103
|
+
config["notesFolder"], config["template"]
|
|
104
|
+
)
|
|
97
105
|
|
|
98
|
-
note_path = create_batch_of_files(
|
|
106
|
+
note_path = create_batch_of_files(config, week, template_path)
|
|
99
107
|
|
|
100
|
-
open_file(
|
|
108
|
+
open_file(
|
|
109
|
+
config["notesFolder"],
|
|
110
|
+
config["editor"],
|
|
111
|
+
note_path,
|
|
112
|
+
config["verbose"],
|
|
113
|
+
config["workspace"],
|
|
114
|
+
)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import argparse
|
|
2
|
-
import pathlib
|
|
3
2
|
import importlib.metadata
|
|
4
3
|
|
|
5
4
|
__version__ = importlib.metadata.version("take-note-cli")
|
|
@@ -24,8 +23,7 @@ def init_argparse() -> argparse.ArgumentParser:
|
|
|
24
23
|
)
|
|
25
24
|
parser.add_argument(
|
|
26
25
|
"--notesFolder",
|
|
27
|
-
default=
|
|
28
|
-
type=pathlib.Path,
|
|
26
|
+
default=None,
|
|
29
27
|
help="""The root path for the notes folder.
|
|
30
28
|
If not supplied this defaults to the Notes
|
|
31
29
|
folder in the users home folder.""",
|
|
@@ -83,7 +81,4 @@ def process_args(args):
|
|
|
83
81
|
parser = init_argparse()
|
|
84
82
|
options = parser.parse_args(args)
|
|
85
83
|
|
|
86
|
-
if options.workspace is not None:
|
|
87
|
-
options.editor = "code"
|
|
88
|
-
|
|
89
84
|
return options, parser
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import pathlib
|
|
2
|
+
import confuse
|
|
3
|
+
|
|
4
|
+
template = {
|
|
5
|
+
"notesFolder": confuse.Path(cwd=pathlib.Path.home()),
|
|
6
|
+
"editor": "code",
|
|
7
|
+
"workspace": None,
|
|
8
|
+
"template": None,
|
|
9
|
+
"batch": None,
|
|
10
|
+
"verbose": False,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def check_for_config_file():
|
|
15
|
+
config = confuse.Configuration("TakeNote")
|
|
16
|
+
|
|
17
|
+
if not config.keys():
|
|
18
|
+
config_filename = pathlib.Path.joinpath(
|
|
19
|
+
pathlib.Path(config.config_dir()), confuse.CONFIG_FILENAME
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
template_filename = pathlib.Path("./src/take_note_cli/config/config.yaml")
|
|
23
|
+
|
|
24
|
+
with open(template_filename, "r") as t:
|
|
25
|
+
with open(config_filename, "w") as f:
|
|
26
|
+
f.writelines(t.readlines())
|
|
27
|
+
|
|
28
|
+
config = check_for_config_file()
|
|
29
|
+
|
|
30
|
+
return config
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def process_config(options):
|
|
34
|
+
config = check_for_config_file()
|
|
35
|
+
config.set_args(options)
|
|
36
|
+
valid_config = config.get(template)
|
|
37
|
+
|
|
38
|
+
workspace = config["workspace"].get(confuse.Optional(confuse.String()))
|
|
39
|
+
if workspace is not None:
|
|
40
|
+
options.editor = "code"
|
|
41
|
+
|
|
42
|
+
return valid_config
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|