jumble-cli 0.1.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,282 @@
1
+ Metadata-Version: 2.5
2
+ Name: jumble-cli
3
+ Version: 0.1.0
4
+ Summary: Random string generator — CLI and Textual TUI
5
+ Project-URL: Homepage, https://github.com/chocs-cat/jumble
6
+ Project-URL: Issues, https://github.com/chocs-cat/jumble/issues
7
+ Author-email: John Foland <johnfoland@users.noreply.github.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Requires-Python: >=3.13
11
+ Requires-Dist: textual>=8.2.8
12
+ Requires-Dist: tomlkit>=0.15.1
13
+ Description-Content-Type: text/markdown
14
+
15
+ <picture>
16
+ <source media="(prefers-color-scheme: dark)" srcset="docs/logo-dark.svg">
17
+ <img alt="jumble" src="docs/logo-light.svg" height="64">
18
+ </picture>
19
+
20
+ jumble generates random strings — passwords, tokens, test data — from the
21
+ command line or an interactive terminal UI. It draws from Python's `secrets`
22
+ module, so the output is fit for secrets.
23
+
24
+ ## Install
25
+
26
+ jumble runs on macOS and Linux. Install it one of these ways; each gives you
27
+ the `jumble` command.
28
+
29
+ ### Homebrew
30
+
31
+ ```sh
32
+ brew install chocs-cat/tap/jumble
33
+ ```
34
+
35
+ The formula lives in the `chocs-cat/tap` tap and brings its own Python.
36
+
37
+ ### PyPI
38
+
39
+ ```sh
40
+ uv tool install jumble-cli
41
+ ```
42
+
43
+ This installs the `jumble-cli` package from PyPI (`jumble` is taken there)
44
+ into its own environment. It needs Python 3.13 or later;
45
+ `pipx install jumble-cli` works the same way.
46
+
47
+ ### From a checkout
48
+
49
+ With [uv](https://docs.astral.sh/uv/), in a clone of this repository:
50
+
51
+ ```sh
52
+ uv tool install .
53
+ ```
54
+
55
+ ## Usage
56
+
57
+ ```sh
58
+ jumble # in a terminal, open the TUI (below)
59
+ jumble -c 1 # one 16-character string of letters and digits
60
+ jumble | pbcopy # the same, piped: bare jumble prints when piped
61
+ jumble -n 32 -c 5 # five 32-character strings
62
+ jumble -s lower,digits -a # lowercase and digits, without look-alikes
63
+ jumble -s lower -s symbols -e # at least one lowercase letter and one symbol
64
+ jumble --custom 'ACGT' -n 40 # only the characters you give
65
+ jumble -s emoji-animals -n 4 -r # four different animals
66
+ jumble -s digits -n 4 -c 20 -u # twenty different four-digit codes
67
+ jumble tui # open the TUI, as bare jumble does in a terminal
68
+ jumble -n 32 -s digits tui # the same, starting from 32 digits
69
+ ```
70
+
71
+ | Option | Effect |
72
+ |---|---|
73
+ | `-n`, `--length N` | characters per string (default 16) |
74
+ | `-c`, `--count N` | how many strings (default 1) |
75
+ | `-s`, `--charset NAME[,NAME…]` | sets to draw from; repeat or separate with commas |
76
+ | `--custom CHARS` | also draw from these characters, as one more set |
77
+ | `-a`, `--no-ambiguous` | leave out look-alikes: ``0 O o l 1 I \| ` ' " ; : . , -`` |
78
+ | `-e`, `--each` | at least one character from every chosen set |
79
+ | `-r`, `--no-repeat` | no character twice within a string |
80
+ | `-u`, `--unique` | no string twice in the output |
81
+ | `-o`, `--output FILE` | write to `FILE`, created or overwritten, instead of stdout; `-` means stdout |
82
+ | `--json` | write one JSON object instead of lines (below) |
83
+ | `--strength` | also print the alphabet size and bits per string to stderr |
84
+ | `--no-config` | ignore the settings file (below) |
85
+ | `--version` | print `jumble <version>` and exit |
86
+
87
+ With no `-s` and no `--custom`, and no characters chosen in the settings
88
+ file, jumble draws from `lower`, `upper`, and `digits`. A character that is
89
+ in more than one chosen set counts once, in the first set of the table below,
90
+ with `--custom` last; a choice left with no characters of its own is an
91
+ error. Each character is one Unicode code point, so `--custom` rejects
92
+ control and combining characters. Errors print
93
+ `jumble: error: …` and exit 2; a failed write, to an `-o` file or to stdout,
94
+ exits 1. When a pipe's reader stops early (`jumble -c 100000 | head -1`),
95
+ jumble exits 1 without a message.
96
+
97
+ jumble generates every string before writing any, so a failed run prints
98
+ nothing and leaves an existing `-o` file as it was. Output is UTF-8, on stdout
99
+ as in a file, whatever the terminal's locale.
100
+
101
+ `--json` writes the strings with the alphabet size, the strength in bits
102
+ (an upper bound with `-e`), and the settings the run used:
103
+
104
+ ```console
105
+ $ jumble --json -n 8 -c 2 -s digits,lower
106
+ {
107
+ "strings": [
108
+ "k3x9q0ba",
109
+ "7mz2wd4e"
110
+ ],
111
+ "alphabet_size": 36,
112
+ "strength_bits": 41.4,
113
+ "strength_is_bound": false,
114
+ "settings": {
115
+ "length": 8,
116
+ "count": 2,
117
+ "charsets": [
118
+ "lower",
119
+ "digits"
120
+ ],
121
+ "custom": "",
122
+ "no_ambiguous": false,
123
+ "each": false,
124
+ "no_repeat": false,
125
+ "unique": false
126
+ }
127
+ }
128
+ ```
129
+
130
+ Errors are never JSON.
131
+
132
+ `--strength` prints a line such as `62 characters · 95.3 bits per string` to
133
+ stderr once the output is written (`at most` before the bits with `-e`), so it
134
+ stays out of a pipe or `-o` file. `-o`, `--json`, and `--strength` don't go
135
+ with `tui`.
136
+
137
+ | Set | Characters | Size |
138
+ |---|---|---|
139
+ | `lower` | `a`–`z` | 26 |
140
+ | `upper` | `A`–`Z` | 26 |
141
+ | `digits` | `0`–`9` | 10 |
142
+ | `symbols` | all ASCII punctuation | 32 |
143
+ | `space` | the space character | 1 |
144
+ | `chess` | ♔…♟ | 12 |
145
+ | `cards` | the 52 standard playing cards 🂡…🃞 | 52 |
146
+ | `dice` | ⚀…⚅ | 6 |
147
+ | `emoji-faces` | 😀…🙏 | 80 |
148
+ | `emoji-animals` | 🐀…🐾 | 63 |
149
+ | `emoji-food` | 🍅…🍻 | 55 |
150
+ | `greek` | Α…Ω, α…ω | 48 |
151
+ | `cyrillic` | А…я | 64 |
152
+ | `latin-accented` | À…ÿ, without × and ÷ | 62 |
153
+ | `arrows` | ←…↙ | 10 |
154
+ | `math` | `±×÷∞≠≈≤≥√∑∏∫∂∆∇∈∉∩∪⊂⊃∀∃¬∧∨` | 26 |
155
+ | `currency` | `¢£¥€₹₽₩₪₺₿₫₱` | 12 |
156
+ | `box` | box drawing and block elements ─…▟ | 160 |
157
+
158
+ ### Settings file
159
+
160
+ jumble starts from a TOML settings file, if there is one, at the first of:
161
+
162
+ - `$JUMBLE_CONFIG`, if set and not empty (a relative path is relative to the
163
+ working directory);
164
+ - `$XDG_CONFIG_HOME/jumble/config.toml`, if that variable is an absolute path;
165
+ - `~/.config/jumble/config.toml`, on macOS too.
166
+
167
+ Its keys are the setting names `--json` shows, and every key is optional:
168
+
169
+ ```toml
170
+ length = 24
171
+ count = 5
172
+ charsets = ["lower", "digits"]
173
+ custom = "!?"
174
+ no_ambiguous = true
175
+ each = true
176
+ no_repeat = false
177
+ unique = false
178
+ ```
179
+
180
+ The command line overrides the file, and the file overrides the built-in
181
+ defaults. `-n` and `-c` win whenever they are given, even at their default
182
+ value (`-n 16` beats `length = 24`). A flag such as `-e` can only turn its
183
+ option on. Characters go as a whole: `-s` or `--custom` (even `--custom ''`)
184
+ replaces both the file's `charsets` and its `custom`, and a file with only
185
+ `custom = "abc"` draws from `abc` alone. `--no-config` ignores the file
186
+ entirely, so the run starts from the built-in defaults.
187
+
188
+ A broken file is an error that names the file and the key, such as
189
+ `jumble: error: /home/me/.config/jumble/config.toml: length: length must be at
190
+ least 1`, even when the command line overrides that key; fix the file or pass
191
+ `--no-config`. Rules that tie settings together are checked on the result
192
+ instead: `each = true` is fine in the file until `-n 2` asks for two
193
+ characters from three sets.
194
+
195
+ The TUI writes the file two ways. Its `d` key saves the controls as they
196
+ stand. Its `,` key opens a settings screen: a form with every setting,
197
+ filled from the file as the command line reads it with no options (the
198
+ built-in defaults where the file says nothing), and the file's path. Save
199
+ writes the form to the file and sets the TUI's controls to it; Cancel or
200
+ `escape` leaves both as they were. Either way, a save changes only the
201
+ values that differ and keeps the file's comments and layout. With no file
202
+ yet, it writes a commented template listing every key.
203
+
204
+ A broken file is repaired by saving over it: the settings screen opens on
205
+ the built-in defaults with the error in a toast, and Save drops unknown
206
+ keys, replaces bad values, and starts a file that isn't TOML at all over
207
+ from the template.
208
+
209
+ ### The TUI
210
+
211
+ `jumble` typed alone in a terminal opens the generator there, and so does
212
+ `jumble tui`. When its input or output isn't a terminal (`jumble | pbcopy`,
213
+ `$(jumble)`, a script), bare `jumble` prints one string instead, and any
214
+ option at all (`jumble -c 1`) prints too. The TUI starts from the settings
215
+ file, like the command line, and options given before `tui` override it:
216
+ `jumble -n 32 -s digits tui` opens on 32-digit strings. A broken settings file
217
+ doesn't stop the TUI: it opens from the built-in defaults and those options,
218
+ with the error in a toast, and `d` or the settings screen saves over it. An
219
+ unknown set name is an error before the TUI opens; any other value it can't
220
+ use (`-n 0`) opens it with the banner showing, to fix there.
221
+
222
+ On the left are the controls: length and count, every character set in the
223
+ table above to check or uncheck, custom characters, and the four options (No
224
+ look-alikes, One from each set, No repeats, All unique). Under the sets, a
225
+ preview shows the characters of the set the list's cursor is on, all of them
226
+ as the set is defined, whatever the options say. On the right are the
227
+ strings, one per row. The header shows the alphabet size and strength for the
228
+ controls as they stand, updated as you change them. When the controls can't
229
+ produce strings, a banner under the header says why, with the same message the
230
+ command line would print, and the strength disappears until you fix them.
231
+ Changing a control leaves the strings alone; only a jumble replaces them. The
232
+ list shows the first 1000 strings and says how many more there are; copying all
233
+ and saving take every one.
234
+
235
+ The keys are listed in the footer:
236
+
237
+ | Key | Action |
238
+ |---|---|
239
+ | `g` | jumble a new batch with the current controls (not while the banner shows) |
240
+ | `c` | copy the string under the cursor |
241
+ | `a` | copy all strings, one per line |
242
+ | `s` | save all strings to a new file, `jumble-<epoch>-<count>.txt`, in the current directory |
243
+ | `d` | save the current controls as the defaults, in the settings file (not while the banner shows) |
244
+ | `,` | open the settings screen, to edit the settings file |
245
+ | `?` | open Help, with every set's characters and notes on the controls |
246
+ | `q` | quit |
247
+
248
+ Focus starts on the strings, so the keys work. In a text box, `enter`
249
+ jumbles (as `g` does) and returns to the strings, and `escape` returns without
250
+ jumbling. While the banner shows, `c`, `a`, and `s` use the last batch.
251
+
252
+ `?` opens Help even while the banner shows. It lists every named set's
253
+ characters, unfiltered as in the preview, then notes on the other controls.
254
+ Scroll with the arrow and page keys or the mouse wheel; `escape` or `?`
255
+ closes it. Opening and closing Help leaves the controls and strings alone,
256
+ and the main keys don't act while it's open. In a text box, `?` is typed
257
+ like any other character.
258
+
259
+ The settings screen shows the file's path in full, wrapped when it's long,
260
+ and keeps Save and Cancel in view: on a short terminal only the form
261
+ scrolls. The keys above don't act while it's open. In its text
262
+ boxes `enter` saves, as its Save button does. Save checks the form as the
263
+ banner would, and while it can't produce strings, saves nothing and says
264
+ why. A save doesn't jumble: the strings stay until the next `g`.
265
+
266
+ `s` never overwrites: if the file exists (a second save in the same second),
267
+ it saves nothing and says so. The file holds the same bytes as `jumble`'s
268
+ output: UTF-8, one string per line.
269
+
270
+ ![The jumble TUI: controls on the left, ten strings on the right](docs/tui.svg)
271
+
272
+ ## Development
273
+
274
+ ```sh
275
+ uv sync
276
+ make check # ruff format and lint, ty, pytest; what CI runs
277
+ make fix # apply formatting and safe lint fixes
278
+ ```
279
+
280
+ ## License
281
+
282
+ MIT; see [LICENSE](LICENSE).
@@ -0,0 +1,11 @@
1
+ jumble/__init__.py,sha256=32NiDZk9-g3sCfCWunGyIyW2XWvZztwLjByuVouNxaw,284
2
+ jumble/__main__.py,sha256=hiS9Y1rzSsZVif-VYUu1extOkjKp0CiCSg1bhjWa0TY,54
3
+ jumble/cli.py,sha256=gMZ1EpdJpH4bfHiYr09WnhrraoS-KMukZfNaIL7iW6U,10145
4
+ jumble/config.py,sha256=5gEdW_2XroXsh9cDTNwf5A41RifJf32erVtyloNxXbI,7152
5
+ jumble/generate.py,sha256=6klzIDoKLz_rf0GO3St_wZkTJIs4MN-ObT0x9U2F_fo,10635
6
+ jumble/tui.py,sha256=6k5R0jISzQmUmQm0j4rQD2n-vUWxs0viYsKVHnihCRU,19047
7
+ jumble_cli-0.1.0.dist-info/METADATA,sha256=f_EXTNrc9wUpKocg3VeDUIPAP1MiE1r9HykDQCxbP_U,11506
8
+ jumble_cli-0.1.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
9
+ jumble_cli-0.1.0.dist-info/entry_points.txt,sha256=5cTl8j9yPTVjqwUSgkuvsxz48x5w35D25HyUTFt4wAY,39
10
+ jumble_cli-0.1.0.dist-info/licenses/LICENSE,sha256=mNGWcfkW6OesVTTZojwW9X5uvUyEaSBKPl9iPCOtyj0,1069
11
+ jumble_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.4
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ jumble = jumble:main
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 John Foland
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.
22
+