Commit ff5e89f
committed
feat(plz): fully configurable plz menu
BREAKING CHANGE: this PR introduces a bunch of brick changes to both the configuration system and the command-line interface.
- Change the `plz` menu system to read the menu entries from the config file
- Each entry contains its display string that will displayed in the menu and its operation/args
- The `operation` is just a hash map that contains the operation key and its value and the rest of the arguments
- Each operation has a specific set of pre-defined arguments that can be used to configure the `operation handler` and change its default behavior.
- The operation handler will ignore any argument that doesn't know about
- However, all the argument values will be passed to the template engine to be parsed before they are passed to the operation handler, which means that if there's any `template error` in any of the arguments the program will exit even if the argument that have the error doesn't needed by the operation handler
- The currently available operations is:
- `fetch` | `url`: fetch any page from the web(mainly) by HTTP
- `run` | `command`: run command/s
- `file`: just display the contents of any local file in the pager
- Remove the following CLI options:
- `--cheat-sh-url`
- `--eg-url`
- `--man-cmd`
- `--cheat-url`
- Introduce the following CLI options:
- `-s` | `--selected-position`: used to set the default selected position, the posable values are:
- `start`: The first item in the menu
- `center`: The middle item in the menu (in case of an even number of items, the first item in the second half)
- `end`: The last item in the menu
COMMITS LIST:
da8bb01 fix: un-use the wildcard pattern and use `as` instead (2 weeks ago)
0fdc42e chore(git): merge main and resolve confilcts (2 weeks ago)
9fd106d docs(readme): update the outdated examples (3 weeks ago)
446efff chore(config): just update the config file (3 weeks ago)
a418fbd fix(test): fix the cli::update_config test and fi doc (3 weeks ago)
0187928 feat(file): create the file handler (3 weeks ago)
a08101f feat(cli): add the --selected-position option to plz subcommand (3 weeks ago)
6d07d80 refactor: refactor and and lint and re-format the whole proj (3 weeks ago)
4dd0702 feat(command): create the command operation handler (3 weeks ago)
3eb71a6 refactor(plz): improve the operation handleing system (3 weeks ago)
3bb10a6 refactor: remove all the deprecate code and re-format the code (3 weeks ago)
9bfc239 revert(idea): remove the `.idea` directory (3 weeks ago)
1babee0 feat(plz): use the new system (3 weeks ago)
f4d845e feat(cmd_parse): take a refrence to the hashmap (3 weeks ago)
0ed22dd feat(fetch): create the fetch handler and stabilize the `Handler` interface (3 weeks ago)
1646c14 feat(parser): cover more cases for the command parser (3 weeks ago)
5b054fb feat(parser): create the command parser (3 weeks ago)
399dfee feat(parser): create the template parser (3 weeks ago)
ad409ab feat(plz): make the defualt selected item configrable (4 weeks ago)
218316a feat(plz): improve the cheat.sh url template (4 weeks ago)
08e7867 feat(plz): create the handler trait (4 weeks ago)
bba0696 feat(plz): read the plz menu from the config file (4 weeks ago)1 parent e35374e commit ff5e89f
File tree
19 files changed
+993
-335
lines changed- config
- src
- config
- helper
- args
- docs
- handlers
19 files changed
+993
-335
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
243 | 254 | | |
244 | 255 | | |
245 | 256 | | |
| |||
313 | 324 | | |
314 | 325 | | |
315 | 326 | | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | 327 | | |
323 | 328 | | |
324 | 329 | | |
| |||
330 | 335 | | |
331 | 336 | | |
332 | 337 | | |
333 | | - | |
| 338 | + | |
334 | 339 | | |
335 | 340 | | |
336 | 341 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | 1 | | |
5 | | - | |
6 | 2 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 3 | + | |
10 | 4 | | |
11 | | - | |
12 | 5 | | |
13 | | - | |
14 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 49 | | |
61 | 50 | | |
62 | 51 | | |
63 | 52 | | |
64 | 53 | | |
65 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
66 | 58 | | |
67 | 59 | | |
68 | 60 | | |
| |||
80 | 72 | | |
81 | 73 | | |
82 | 74 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | 75 | | |
87 | 76 | | |
| 77 | + | |
88 | 78 | | |
89 | 79 | | |
90 | 80 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | 81 | | |
101 | 82 | | |
102 | 83 | | |
103 | 84 | | |
104 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
105 | 89 | | |
106 | 90 | | |
107 | 91 | | |
| |||
125 | 109 | | |
126 | 110 | | |
127 | 111 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 112 | + | |
132 | 113 | | |
133 | 114 | | |
134 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 29 | + | |
| 30 | + | |
34 | 31 | | |
35 | 32 | | |
36 | 33 | | |
| |||
50 | 47 | | |
51 | 48 | | |
52 | 49 | | |
53 | | - | |
54 | | - | |
55 | | - | |
| 50 | + | |
56 | 51 | | |
57 | 52 | | |
58 | 53 | | |
| |||
122 | 117 | | |
123 | 118 | | |
124 | 119 | | |
125 | | - | |
126 | 120 | | |
127 | 121 | | |
128 | 122 | | |
| |||
136 | 130 | | |
137 | 131 | | |
138 | 132 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | 133 | | |
144 | 134 | | |
145 | 135 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
24 | 43 | | |
25 | 44 | | |
26 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
| 218 | + | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
| 280 | + | |
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| |||
0 commit comments