mark-stash 0.1.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.
- mark_stash-0.1.0/LICENSE +21 -0
- mark_stash-0.1.0/MANIFEST.in +3 -0
- mark_stash-0.1.0/PKG-INFO +192 -0
- mark_stash-0.1.0/README.md +162 -0
- mark_stash-0.1.0/README.zh-CN.md +154 -0
- mark_stash-0.1.0/mark_cli/__init__.py +8 -0
- mark_stash-0.1.0/mark_cli/__main__.py +8 -0
- mark_stash-0.1.0/mark_cli/cli.py +401 -0
- mark_stash-0.1.0/mark_stash.egg-info/PKG-INFO +192 -0
- mark_stash-0.1.0/mark_stash.egg-info/SOURCES.txt +15 -0
- mark_stash-0.1.0/mark_stash.egg-info/dependency_links.txt +1 -0
- mark_stash-0.1.0/mark_stash.egg-info/entry_points.txt +2 -0
- mark_stash-0.1.0/mark_stash.egg-info/requires.txt +4 -0
- mark_stash-0.1.0/mark_stash.egg-info/top_level.txt +1 -0
- mark_stash-0.1.0/pyproject.toml +42 -0
- mark_stash-0.1.0/setup.cfg +4 -0
- mark_stash-0.1.0/tests/test_mark.py +217 -0
mark_stash-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 neo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mark-stash
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A tiny one-line note list with an fzf picker and clipboard copy
|
|
5
|
+
Author-email: neo <qqiwei@users.noreply.github.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/qqiwei/mark
|
|
8
|
+
Project-URL: Repository, https://github.com/qqiwei/mark
|
|
9
|
+
Project-URL: Issues, https://github.com/qqiwei/mark/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/qqiwei/mark/commits/main
|
|
11
|
+
Keywords: notes,clipboard,fzf,cli,productivity
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
28
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# mark
|
|
32
|
+
|
|
33
|
+
**English** | [简体中文](README.zh-CN.md)
|
|
34
|
+
|
|
35
|
+
A tiny command-line "note here" list: record one-line snippets with
|
|
36
|
+
`mark <text>`, then run `mark` with no arguments to fuzzy-pick one and copy it
|
|
37
|
+
to the clipboard. No database, no dependencies — just a plain text file and
|
|
38
|
+
[`fzf`](https://github.com/junegunn/fzf).
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
$ mark https://example.com/read-later
|
|
42
|
+
$ mark ask Alice about the invoice
|
|
43
|
+
$ mark
|
|
44
|
+
> ask Alice about the invoice # fzf opens, type a few letters
|
|
45
|
+
ask Alice about the invoice # Enter: copied to the clipboard
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Why
|
|
49
|
+
|
|
50
|
+
Sometimes you just need to park a URL, an address, an ID or a sentence for a
|
|
51
|
+
minute. `mark` keeps that list one keystroke away and copies the chosen line,
|
|
52
|
+
so it can be pasted anywhere.
|
|
53
|
+
|
|
54
|
+
## Requirements
|
|
55
|
+
|
|
56
|
+
- Python 3.11+
|
|
57
|
+
- `fzf` for the fuzzy picker (optional — without it you get a numbered list)
|
|
58
|
+
- a clipboard tool: `pbcopy` on macOS, `wl-copy` / `xclip` / `xsel` on Linux,
|
|
59
|
+
`clip` on Windows. If none is found the chosen mark is simply printed.
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
The PyPI distribution is `mark-stash`; the command is still `mark`:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
pipx install mark-stash # recommended: isolated environment
|
|
67
|
+
uv tool install mark-stash
|
|
68
|
+
pip install --user mark-stash
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Upgrade / uninstall (your list is kept):
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
pipx upgrade mark-stash
|
|
75
|
+
pipx uninstall mark-stash
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
From a source checkout:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
git clone git@github.com:qqiwei/mark.git
|
|
82
|
+
cd mark
|
|
83
|
+
pipx install --editable . # live edits, command available as `mark`
|
|
84
|
+
# or run it without installing:
|
|
85
|
+
./mark --version
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Usage
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
mark buy milk, eggs # record a line
|
|
92
|
+
mark "https://example.com" # quote spaces and shell characters
|
|
93
|
+
mark # fuzzy-pick and copy (Enter), cancel with Esc
|
|
94
|
+
mark -l # list marks, newest first
|
|
95
|
+
mark -d # delete repeatedly; Esc quits
|
|
96
|
+
mark -m # pick a mark and edit it; Enter saves, Esc cancels
|
|
97
|
+
mark --path # print where the mark file lives
|
|
98
|
+
mark -- -l # record a line that starts with a dash
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Notes:
|
|
102
|
+
|
|
103
|
+
- Arguments are joined with single spaces: `mark buy milk` records `buy milk`.
|
|
104
|
+
- A newline inside one argument becomes several marks:
|
|
105
|
+
`mark "$(pbpaste)"` records each pasted line separately.
|
|
106
|
+
- Recording an existing line moves it to the newest position instead of
|
|
107
|
+
creating a duplicate.
|
|
108
|
+
- `mark -d` stays open after each deletion (and keeps the current fzf query),
|
|
109
|
+
so several marks can be removed in a row; press Esc to stop. If the list
|
|
110
|
+
becomes empty it exits by itself.
|
|
111
|
+
- `mark -m` picks a line the same way, then re-opens fzf with that text
|
|
112
|
+
pre-filled in the prompt: edit it in place, press Enter to save, or Esc to
|
|
113
|
+
cancel. Editing a line into text that already exists drops the older
|
|
114
|
+
duplicate; an empty line is rejected and nothing changes.
|
|
115
|
+
- When `mark` is cancelled (Esc / Ctrl-C) it exits with status 130.
|
|
116
|
+
- Running `mark` with no arguments and an empty list prints a hint and exits 1.
|
|
117
|
+
|
|
118
|
+
## Storage
|
|
119
|
+
|
|
120
|
+
One mark per line, UTF-8, newest last. The file is created with mode `0600`
|
|
121
|
+
and lives outside the repository:
|
|
122
|
+
|
|
123
|
+
| Platform | Default path |
|
|
124
|
+
| --- | --- |
|
|
125
|
+
| macOS | `~/Library/Application Support/mark/marks.txt` |
|
|
126
|
+
| Linux / others | `$XDG_DATA_HOME/mark/marks.txt` (usually `~/.local/share/mark/marks.txt`) |
|
|
127
|
+
|
|
128
|
+
Because it is a plain text file you can edit it by hand, `grep` it, or sync it
|
|
129
|
+
with your notes. The repository ignores `*.txt`, so it can never be committed
|
|
130
|
+
by accident.
|
|
131
|
+
|
|
132
|
+
### Environment variables
|
|
133
|
+
|
|
134
|
+
| Variable | Meaning |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| `MARK_FILE` | Use another mark file (`~` is expanded) |
|
|
137
|
+
| `MARK_FZF` | Path or name of the picker to run instead of `fzf` |
|
|
138
|
+
| `MARK_PROMPT` | Picker prompt (default `mark> `) |
|
|
139
|
+
|
|
140
|
+
## Development
|
|
141
|
+
|
|
142
|
+
```sh
|
|
143
|
+
git clone git@github.com:qqiwei/mark.git
|
|
144
|
+
cd mark
|
|
145
|
+
pipx install --editable .
|
|
146
|
+
python3 -m unittest discover -s tests -v
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Layout:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
mark_cli/
|
|
153
|
+
__init__.py version lookup
|
|
154
|
+
__main__.py python -m mark_cli
|
|
155
|
+
cli.py storage, picker, clipboard and the argparse entry point
|
|
156
|
+
mark source launcher (adds the repo root to sys.path)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The tests set `MARK_FILE` to a temporary file, so they never touch your list.
|
|
160
|
+
|
|
161
|
+
## Uninstall
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
pipx uninstall mark-stash
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Optionally delete the list too:
|
|
168
|
+
|
|
169
|
+
```sh
|
|
170
|
+
rm -r ~/Library/Application\ Support/mark # macOS
|
|
171
|
+
rm -r ~/.local/share/mark # Linux
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Releasing
|
|
175
|
+
|
|
176
|
+
The version lives in `pyproject.toml` (with a fallback in
|
|
177
|
+
`mark_cli/__init__.py`). Push a `v*` tag and the workflow runs the tests,
|
|
178
|
+
builds the sdist/wheel, checks the metadata and publishes with PyPI trusted
|
|
179
|
+
publishing (no API token needed):
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
git tag v0.1.0
|
|
183
|
+
git push origin main --tags
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Before the first release, add a pending publisher on PyPI: project
|
|
187
|
+
`mark-stash`, owner `qqiwei`, repository `mark`, workflow `publish.yml`,
|
|
188
|
+
environment `pypi`.
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# mark
|
|
2
|
+
|
|
3
|
+
**English** | [简体中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
A tiny command-line "note here" list: record one-line snippets with
|
|
6
|
+
`mark <text>`, then run `mark` with no arguments to fuzzy-pick one and copy it
|
|
7
|
+
to the clipboard. No database, no dependencies — just a plain text file and
|
|
8
|
+
[`fzf`](https://github.com/junegunn/fzf).
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
$ mark https://example.com/read-later
|
|
12
|
+
$ mark ask Alice about the invoice
|
|
13
|
+
$ mark
|
|
14
|
+
> ask Alice about the invoice # fzf opens, type a few letters
|
|
15
|
+
ask Alice about the invoice # Enter: copied to the clipboard
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Why
|
|
19
|
+
|
|
20
|
+
Sometimes you just need to park a URL, an address, an ID or a sentence for a
|
|
21
|
+
minute. `mark` keeps that list one keystroke away and copies the chosen line,
|
|
22
|
+
so it can be pasted anywhere.
|
|
23
|
+
|
|
24
|
+
## Requirements
|
|
25
|
+
|
|
26
|
+
- Python 3.11+
|
|
27
|
+
- `fzf` for the fuzzy picker (optional — without it you get a numbered list)
|
|
28
|
+
- a clipboard tool: `pbcopy` on macOS, `wl-copy` / `xclip` / `xsel` on Linux,
|
|
29
|
+
`clip` on Windows. If none is found the chosen mark is simply printed.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
The PyPI distribution is `mark-stash`; the command is still `mark`:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
pipx install mark-stash # recommended: isolated environment
|
|
37
|
+
uv tool install mark-stash
|
|
38
|
+
pip install --user mark-stash
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Upgrade / uninstall (your list is kept):
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
pipx upgrade mark-stash
|
|
45
|
+
pipx uninstall mark-stash
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
From a source checkout:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
git clone git@github.com:qqiwei/mark.git
|
|
52
|
+
cd mark
|
|
53
|
+
pipx install --editable . # live edits, command available as `mark`
|
|
54
|
+
# or run it without installing:
|
|
55
|
+
./mark --version
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
mark buy milk, eggs # record a line
|
|
62
|
+
mark "https://example.com" # quote spaces and shell characters
|
|
63
|
+
mark # fuzzy-pick and copy (Enter), cancel with Esc
|
|
64
|
+
mark -l # list marks, newest first
|
|
65
|
+
mark -d # delete repeatedly; Esc quits
|
|
66
|
+
mark -m # pick a mark and edit it; Enter saves, Esc cancels
|
|
67
|
+
mark --path # print where the mark file lives
|
|
68
|
+
mark -- -l # record a line that starts with a dash
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Notes:
|
|
72
|
+
|
|
73
|
+
- Arguments are joined with single spaces: `mark buy milk` records `buy milk`.
|
|
74
|
+
- A newline inside one argument becomes several marks:
|
|
75
|
+
`mark "$(pbpaste)"` records each pasted line separately.
|
|
76
|
+
- Recording an existing line moves it to the newest position instead of
|
|
77
|
+
creating a duplicate.
|
|
78
|
+
- `mark -d` stays open after each deletion (and keeps the current fzf query),
|
|
79
|
+
so several marks can be removed in a row; press Esc to stop. If the list
|
|
80
|
+
becomes empty it exits by itself.
|
|
81
|
+
- `mark -m` picks a line the same way, then re-opens fzf with that text
|
|
82
|
+
pre-filled in the prompt: edit it in place, press Enter to save, or Esc to
|
|
83
|
+
cancel. Editing a line into text that already exists drops the older
|
|
84
|
+
duplicate; an empty line is rejected and nothing changes.
|
|
85
|
+
- When `mark` is cancelled (Esc / Ctrl-C) it exits with status 130.
|
|
86
|
+
- Running `mark` with no arguments and an empty list prints a hint and exits 1.
|
|
87
|
+
|
|
88
|
+
## Storage
|
|
89
|
+
|
|
90
|
+
One mark per line, UTF-8, newest last. The file is created with mode `0600`
|
|
91
|
+
and lives outside the repository:
|
|
92
|
+
|
|
93
|
+
| Platform | Default path |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| macOS | `~/Library/Application Support/mark/marks.txt` |
|
|
96
|
+
| Linux / others | `$XDG_DATA_HOME/mark/marks.txt` (usually `~/.local/share/mark/marks.txt`) |
|
|
97
|
+
|
|
98
|
+
Because it is a plain text file you can edit it by hand, `grep` it, or sync it
|
|
99
|
+
with your notes. The repository ignores `*.txt`, so it can never be committed
|
|
100
|
+
by accident.
|
|
101
|
+
|
|
102
|
+
### Environment variables
|
|
103
|
+
|
|
104
|
+
| Variable | Meaning |
|
|
105
|
+
| --- | --- |
|
|
106
|
+
| `MARK_FILE` | Use another mark file (`~` is expanded) |
|
|
107
|
+
| `MARK_FZF` | Path or name of the picker to run instead of `fzf` |
|
|
108
|
+
| `MARK_PROMPT` | Picker prompt (default `mark> `) |
|
|
109
|
+
|
|
110
|
+
## Development
|
|
111
|
+
|
|
112
|
+
```sh
|
|
113
|
+
git clone git@github.com:qqiwei/mark.git
|
|
114
|
+
cd mark
|
|
115
|
+
pipx install --editable .
|
|
116
|
+
python3 -m unittest discover -s tests -v
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Layout:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
mark_cli/
|
|
123
|
+
__init__.py version lookup
|
|
124
|
+
__main__.py python -m mark_cli
|
|
125
|
+
cli.py storage, picker, clipboard and the argparse entry point
|
|
126
|
+
mark source launcher (adds the repo root to sys.path)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The tests set `MARK_FILE` to a temporary file, so they never touch your list.
|
|
130
|
+
|
|
131
|
+
## Uninstall
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
pipx uninstall mark-stash
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Optionally delete the list too:
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
rm -r ~/Library/Application\ Support/mark # macOS
|
|
141
|
+
rm -r ~/.local/share/mark # Linux
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Releasing
|
|
145
|
+
|
|
146
|
+
The version lives in `pyproject.toml` (with a fallback in
|
|
147
|
+
`mark_cli/__init__.py`). Push a `v*` tag and the workflow runs the tests,
|
|
148
|
+
builds the sdist/wheel, checks the metadata and publishes with PyPI trusted
|
|
149
|
+
publishing (no API token needed):
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
git tag v0.1.0
|
|
153
|
+
git push origin main --tags
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Before the first release, add a pending publisher on PyPI: project
|
|
157
|
+
`mark-stash`, owner `qqiwei`, repository `mark`, workflow `publish.yml`,
|
|
158
|
+
environment `pypi`.
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# mark
|
|
2
|
+
|
|
3
|
+
[English](README.md) | **简体中文**
|
|
4
|
+
|
|
5
|
+
一个极简的命令行「随手记」清单:用 `mark <文本>` 记下一行,之后直接敲
|
|
6
|
+
`mark`,像 fzf 一样模糊匹配,选中就复制到剪贴板。没有数据库、没有依赖——
|
|
7
|
+
就是一个纯文本文件加 [`fzf`](https://github.com/junegunn/fzf)。
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
$ mark https://example.com/read-later
|
|
11
|
+
$ mark 问一下 Alice 发票的事
|
|
12
|
+
$ mark
|
|
13
|
+
> 问一下 Alice 发票的事 # 打开 fzf,输入几个字
|
|
14
|
+
问一下 Alice 发票的事 # 回车:已复制到剪贴板
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 用途
|
|
18
|
+
|
|
19
|
+
有时候只是想临时放一个链接、地址、单号或一句话。`mark` 把它存成一行,
|
|
20
|
+
下次敲 `mark` 模糊找出来、回车即复制,可以直接粘贴到任何地方。
|
|
21
|
+
|
|
22
|
+
## 依赖
|
|
23
|
+
|
|
24
|
+
- Python 3.11+
|
|
25
|
+
- `fzf`(可选;没有时退化为编号选择)
|
|
26
|
+
- 剪贴板工具:macOS 用 `pbcopy`,Linux 用 `wl-copy` / `xclip` / `xsel`,
|
|
27
|
+
Windows 用 `clip`。一个都找不到时只把选中的内容打印出来。
|
|
28
|
+
|
|
29
|
+
## 安装
|
|
30
|
+
|
|
31
|
+
PyPI 发行名是 `mark-stash`,命令名仍然是 `mark`:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pipx install mark-stash # 推荐:独立环境
|
|
35
|
+
uv tool install mark-stash
|
|
36
|
+
pip install --user mark-stash
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
升级 / 卸载(记录不会丢):
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
pipx upgrade mark-stash
|
|
43
|
+
pipx uninstall mark-stash
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
从源码安装:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
git clone git@github.com:qqiwei/mark.git
|
|
50
|
+
cd mark
|
|
51
|
+
pipx install --editable . # 改代码立即生效,命令仍是 mark
|
|
52
|
+
# 或者不安装,直接跑:
|
|
53
|
+
./mark --version
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 用法
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
mark 买牛奶、鸡蛋 # 记录一行
|
|
60
|
+
mark "https://example.com" # 有空格或 shell 特殊字符时加引号
|
|
61
|
+
mark # 模糊匹配并复制(回车),Esc 取消
|
|
62
|
+
mark -l # 列出所有记录,最新的在前
|
|
63
|
+
mark -d # 连续删除,Esc 退出
|
|
64
|
+
mark -m # 选中一条并修改,回车保存,Esc 取消
|
|
65
|
+
mark --path # 显示记录文件的位置
|
|
66
|
+
mark -- -l # 记录以短横线开头的内容
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
说明:
|
|
70
|
+
|
|
71
|
+
- 多个参数会用单个空格拼起来:`mark 买牛奶 鸡蛋` 记录的是 `买牛奶 鸡蛋`。
|
|
72
|
+
- 一个参数里的换行会拆成多条记录:`mark "$(pbpaste)"` 会把剪贴板里每一行
|
|
73
|
+
分别记下来。
|
|
74
|
+
- 记录已存在的行时,会把它移到最新位置,而不是产生重复。
|
|
75
|
+
- `mark -d` 每删掉一条会继续等待下一条,并保留当前的 fzf 搜索词,可以连续
|
|
76
|
+
删除多条;按 Esc 才退出。列表删空时会自动退出。
|
|
77
|
+
- `mark -m` 用同样的方式选中一条,然后重新打开 fzf,把原文预填在输入框里,
|
|
78
|
+
直接改完回车保存,按 Esc 取消。改成已存在的文本会去掉旧的重复行;改成空
|
|
79
|
+
内容会被拒绝,清单保持不变。
|
|
80
|
+
- 取消选择(Esc / Ctrl-C)时退出码是 130。
|
|
81
|
+
- 列表为空时直接运行 `mark` 会提示先记录,退出码 1。
|
|
82
|
+
|
|
83
|
+
## 存储
|
|
84
|
+
|
|
85
|
+
纯文本,一行一条,UTF-8,最新的在最后一行。文件权限是 `0600`,且放在仓库
|
|
86
|
+
之外:
|
|
87
|
+
|
|
88
|
+
| 平台 | 默认路径 |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| macOS | `~/Library/Application Support/mark/marks.txt` |
|
|
91
|
+
| Linux / 其他 | `$XDG_DATA_HOME/mark/marks.txt`(通常是 `~/.local/share/mark/marks.txt`) |
|
|
92
|
+
|
|
93
|
+
因为是纯文本,你可以直接编辑、用 `grep` 搜,或者跟笔记一起同步。仓库的
|
|
94
|
+
`.gitignore` 忽略了 `*.txt`,所以它不会被误提交。
|
|
95
|
+
|
|
96
|
+
### 环境变量
|
|
97
|
+
|
|
98
|
+
| 变量 | 作用 |
|
|
99
|
+
| --- | --- |
|
|
100
|
+
| `MARK_FILE` | 换一个记录文件(支持 `~`) |
|
|
101
|
+
| `MARK_FZF` | 指定别的选择器,代替 `fzf` |
|
|
102
|
+
| `MARK_PROMPT` | 选择器的提示符(默认 `mark> `) |
|
|
103
|
+
|
|
104
|
+
## 开发
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
git clone git@github.com:qqiwei/mark.git
|
|
108
|
+
cd mark
|
|
109
|
+
pipx install --editable .
|
|
110
|
+
python3 -m unittest discover -s tests -v
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
目录结构:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
mark_cli/
|
|
117
|
+
__init__.py 版本号读取
|
|
118
|
+
__main__.py python -m mark_cli
|
|
119
|
+
cli.py 存储、选择器、剪贴板与 argparse 入口
|
|
120
|
+
mark 源码启动器(把仓库根目录加进 sys.path)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
测试会把 `MARK_FILE` 指向临时文件,不会动你的真实清单。
|
|
124
|
+
|
|
125
|
+
## 卸载
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
pipx uninstall mark-stash
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
想连记录一起删掉:
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
rm -r ~/Library/Application\ Support/mark # macOS
|
|
135
|
+
rm -r ~/.local/share/mark # Linux
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 发布(维护者)
|
|
139
|
+
|
|
140
|
+
版本号写在 `pyproject.toml`(`mark_cli/__init__.py` 里有同样的回退值)。推一个
|
|
141
|
+
`v*` tag,workflow 会跑测试、构建、`twine check`,然后用 PyPI trusted
|
|
142
|
+
publishing 上传(不需要 API token):
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
git tag v0.1.0
|
|
146
|
+
git push origin main --tags
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
首次发布前在 PyPI 添加 pending publisher:项目 `mark-stash`、owner `qqiwei`、
|
|
150
|
+
仓库 `mark`、workflow `publish.yml`、environment `pypi`。
|
|
151
|
+
|
|
152
|
+
## 许可证
|
|
153
|
+
|
|
154
|
+
MIT,见 [LICENSE](LICENSE)。
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""mark - a tiny one-line note list with an fzf picker and clipboard copy."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version as _dist_version
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
__version__ = _dist_version("mark-stash")
|
|
7
|
+
except PackageNotFoundError: # source checkout without an installation
|
|
8
|
+
__version__ = "0.1.0"
|