edir 2.34__tar.gz → 2.35__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.
- {edir-2.34 → edir-2.35}/PKG-INFO +39 -13
- {edir-2.34 → edir-2.35}/README.md +38 -12
- {edir-2.34 → edir-2.35}/edir.egg-info/PKG-INFO +39 -13
- edir-2.35/edir.egg-info/top_level.txt +1 -0
- {edir-2.34 → edir-2.35}/edir.py +50 -9
- edir-2.34/edir.egg-info/top_level.txt +0 -1
- {edir-2.34 → edir-2.35}/.gitignore +0 -0
- {edir-2.34 → edir-2.35}/edir.egg-info/SOURCES.txt +0 -0
- {edir-2.34 → edir-2.35}/edir.egg-info/dependency_links.txt +0 -0
- {edir-2.34 → edir-2.35}/edir.egg-info/entry_points.txt +0 -0
- {edir-2.34 → edir-2.35}/edir.egg-info/requires.txt +0 -0
- {edir-2.34 → edir-2.35}/justfile +0 -0
- {edir-2.34 → edir-2.35}/pyproject.toml +0 -0
- {edir-2.34 → edir-2.35}/setup.cfg +0 -0
{edir-2.34 → edir-2.35}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: edir
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.35
|
|
4
4
|
Summary: Utility to rename, remove, and copy files/dirs using your editor
|
|
5
5
|
Author-email: Mark Blakeney <mark.blakeney@bullet-systems.net>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -186,7 +186,13 @@ following ways:
|
|
|
186
186
|
26. `vidir` returns an error when attempting to rename across different
|
|
187
187
|
file systems, which `edir` allows.
|
|
188
188
|
|
|
189
|
-
27. `edir`
|
|
189
|
+
27. By default, `edir` shows given paths relative to the current working
|
|
190
|
+
directory so that file names are shorter and easier to read/edit. `vidir`
|
|
191
|
+
shows absolute paths (if they are given like that on the command line, e.g.
|
|
192
|
+
by an external tool). You can disable this relative path behavior in `edir`
|
|
193
|
+
if you want.
|
|
194
|
+
|
|
195
|
+
28. `edir` always ensures editor line numbers have the same width (e.g.
|
|
190
196
|
`1` to `6` for 6 files, or `01` to `12` for 12 files, etc) so that
|
|
191
197
|
file names always line up justified. This facilitates block editing
|
|
192
198
|
of file names, e.g. using vim's [visual block
|
|
@@ -194,7 +200,7 @@ following ways:
|
|
|
194
200
|
do this so file names can be jagged wrt each other which makes block
|
|
195
201
|
editing awkward.
|
|
196
202
|
|
|
197
|
-
|
|
203
|
+
29. `edir` is very strict about the format of the lines you edit and
|
|
198
204
|
immediately exits with an error message (before changing anything)
|
|
199
205
|
if you format one of the lines incorrectly. All lines in the edited
|
|
200
206
|
list:
|
|
@@ -210,7 +216,7 @@ following ways:
|
|
|
210
216
|
line so an easy way to swap two file names is just to swap their
|
|
211
217
|
numbers.
|
|
212
218
|
|
|
213
|
-
|
|
219
|
+
30. `edir` always actions files consistently. The sequence of
|
|
214
220
|
operations applied is:
|
|
215
221
|
|
|
216
222
|
1. Deleted files are removed and all renamed files and directories
|
|
@@ -261,7 +267,7 @@ temporarily.
|
|
|
261
267
|
|
|
262
268
|
You can specify an alternative trash program, e.g.
|
|
263
269
|
[`trash-d`](https://github.com/rushsteve1/trash-d), or
|
|
264
|
-
[`gio trash`](https://man.archlinux.org/man/gio.1
|
|
270
|
+
[`gio trash`](https://man.archlinux.org/man/gio.1), or
|
|
265
271
|
[`gtrash put`](https://github.com/umlx5h/gtrash),
|
|
266
272
|
by setting the `--trash-program` option. Most likely you
|
|
267
273
|
want to set this as a [default option](#command-default-options).
|
|
@@ -339,12 +345,16 @@ command line arguments. Comments in the file (i.e. starting with a `#`)
|
|
|
339
345
|
are ignored. Type `edir -h` to see all [supported
|
|
340
346
|
options](#command-line-options).
|
|
341
347
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
+
Some options, e.g. `--recurse`, which can be set as a default option, provide
|
|
349
|
+
another "on-the-fly" negation option to temporarily override and disable the
|
|
350
|
+
default using the command line. E.g. use `-R` to override default `--recurse`.
|
|
351
|
+
See the usage summary for details.
|
|
352
|
+
|
|
353
|
+
You can conveniently edit your default options file using the `--conf` option:
|
|
354
|
+
|
|
355
|
+
```sh
|
|
356
|
+
$ edir --conf
|
|
357
|
+
```
|
|
348
358
|
|
|
349
359
|
## Examples
|
|
350
360
|
|
|
@@ -381,7 +391,7 @@ Type `edir -h` to view the usage summary:
|
|
|
381
391
|
usage: edir [-h] [-i] [-I] [-a] [-A] [-r] [-R] [-q] [-Q] [-G] [-g] [-t]
|
|
382
392
|
[-T] [--trash-program TRASH_PROGRAM] [-c] [-C] [-d DEPTH] [-F |
|
|
383
393
|
-D] [-L] [-N] [-M] [-S] [-O] [--OP OP] [-E] [-X] [-Y] [-Z]
|
|
384
|
-
[--suffix SUFFIX] [-V]
|
|
394
|
+
[--suffix SUFFIX] [--no-relative] [-V] [--conf]
|
|
385
395
|
[args ...]
|
|
386
396
|
|
|
387
397
|
Command line utility to rename, remove, or copy files and directories directly
|
|
@@ -434,7 +444,11 @@ options:
|
|
|
434
444
|
group directories last (including when sorted)
|
|
435
445
|
-Z, --no-group-dirs negate the options to group directories
|
|
436
446
|
--suffix SUFFIX specify suffix for temp editor file, default=".sh"
|
|
447
|
+
--no-relative do not forcibly show paths relative to current working
|
|
448
|
+
directory
|
|
437
449
|
-V, --version show edir version
|
|
450
|
+
--conf just invoke your editor on your startup options
|
|
451
|
+
configuration file
|
|
438
452
|
|
|
439
453
|
Note you can set default starting options in ~/.config/edir-flags.conf. The
|
|
440
454
|
negation options (i.e. the --no-* options) allow you to temporarily override
|
|
@@ -485,7 +499,19 @@ class edir(Command):
|
|
|
485
499
|
## Use with Yazi File Manager
|
|
486
500
|
|
|
487
501
|
If you use [`yazi`][yazi] for your file manager then you don't need any special
|
|
488
|
-
configuration. Just type `:edir` from within [`yazi`][yazi]
|
|
502
|
+
configuration. Just type `:edir` from within [`yazi`][yazi] to edit all file
|
|
503
|
+
names in the current directory.
|
|
504
|
+
|
|
505
|
+
You can also replace the standard rename function (`r` key) in [`yazi`][yazi]
|
|
506
|
+
to use `edir` on selected files by adding the following to your
|
|
507
|
+
`~/.config/yazi/keymap.toml` file:
|
|
508
|
+
|
|
509
|
+
```toml
|
|
510
|
+
[[mgr.prepend_keymap]]
|
|
511
|
+
on = "r"
|
|
512
|
+
run = "shell --block -- edir -q %s"
|
|
513
|
+
desc = "Run edir on selected files/dirs"
|
|
514
|
+
```
|
|
489
515
|
|
|
490
516
|
## License
|
|
491
517
|
|
|
@@ -172,7 +172,13 @@ following ways:
|
|
|
172
172
|
26. `vidir` returns an error when attempting to rename across different
|
|
173
173
|
file systems, which `edir` allows.
|
|
174
174
|
|
|
175
|
-
27. `edir`
|
|
175
|
+
27. By default, `edir` shows given paths relative to the current working
|
|
176
|
+
directory so that file names are shorter and easier to read/edit. `vidir`
|
|
177
|
+
shows absolute paths (if they are given like that on the command line, e.g.
|
|
178
|
+
by an external tool). You can disable this relative path behavior in `edir`
|
|
179
|
+
if you want.
|
|
180
|
+
|
|
181
|
+
28. `edir` always ensures editor line numbers have the same width (e.g.
|
|
176
182
|
`1` to `6` for 6 files, or `01` to `12` for 12 files, etc) so that
|
|
177
183
|
file names always line up justified. This facilitates block editing
|
|
178
184
|
of file names, e.g. using vim's [visual block
|
|
@@ -180,7 +186,7 @@ following ways:
|
|
|
180
186
|
do this so file names can be jagged wrt each other which makes block
|
|
181
187
|
editing awkward.
|
|
182
188
|
|
|
183
|
-
|
|
189
|
+
29. `edir` is very strict about the format of the lines you edit and
|
|
184
190
|
immediately exits with an error message (before changing anything)
|
|
185
191
|
if you format one of the lines incorrectly. All lines in the edited
|
|
186
192
|
list:
|
|
@@ -196,7 +202,7 @@ following ways:
|
|
|
196
202
|
line so an easy way to swap two file names is just to swap their
|
|
197
203
|
numbers.
|
|
198
204
|
|
|
199
|
-
|
|
205
|
+
30. `edir` always actions files consistently. The sequence of
|
|
200
206
|
operations applied is:
|
|
201
207
|
|
|
202
208
|
1. Deleted files are removed and all renamed files and directories
|
|
@@ -247,7 +253,7 @@ temporarily.
|
|
|
247
253
|
|
|
248
254
|
You can specify an alternative trash program, e.g.
|
|
249
255
|
[`trash-d`](https://github.com/rushsteve1/trash-d), or
|
|
250
|
-
[`gio trash`](https://man.archlinux.org/man/gio.1
|
|
256
|
+
[`gio trash`](https://man.archlinux.org/man/gio.1), or
|
|
251
257
|
[`gtrash put`](https://github.com/umlx5h/gtrash),
|
|
252
258
|
by setting the `--trash-program` option. Most likely you
|
|
253
259
|
want to set this as a [default option](#command-default-options).
|
|
@@ -325,12 +331,16 @@ command line arguments. Comments in the file (i.e. starting with a `#`)
|
|
|
325
331
|
are ignored. Type `edir -h` to see all [supported
|
|
326
332
|
options](#command-line-options).
|
|
327
333
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
+
Some options, e.g. `--recurse`, which can be set as a default option, provide
|
|
335
|
+
another "on-the-fly" negation option to temporarily override and disable the
|
|
336
|
+
default using the command line. E.g. use `-R` to override default `--recurse`.
|
|
337
|
+
See the usage summary for details.
|
|
338
|
+
|
|
339
|
+
You can conveniently edit your default options file using the `--conf` option:
|
|
340
|
+
|
|
341
|
+
```sh
|
|
342
|
+
$ edir --conf
|
|
343
|
+
```
|
|
334
344
|
|
|
335
345
|
## Examples
|
|
336
346
|
|
|
@@ -367,7 +377,7 @@ Type `edir -h` to view the usage summary:
|
|
|
367
377
|
usage: edir [-h] [-i] [-I] [-a] [-A] [-r] [-R] [-q] [-Q] [-G] [-g] [-t]
|
|
368
378
|
[-T] [--trash-program TRASH_PROGRAM] [-c] [-C] [-d DEPTH] [-F |
|
|
369
379
|
-D] [-L] [-N] [-M] [-S] [-O] [--OP OP] [-E] [-X] [-Y] [-Z]
|
|
370
|
-
[--suffix SUFFIX] [-V]
|
|
380
|
+
[--suffix SUFFIX] [--no-relative] [-V] [--conf]
|
|
371
381
|
[args ...]
|
|
372
382
|
|
|
373
383
|
Command line utility to rename, remove, or copy files and directories directly
|
|
@@ -420,7 +430,11 @@ options:
|
|
|
420
430
|
group directories last (including when sorted)
|
|
421
431
|
-Z, --no-group-dirs negate the options to group directories
|
|
422
432
|
--suffix SUFFIX specify suffix for temp editor file, default=".sh"
|
|
433
|
+
--no-relative do not forcibly show paths relative to current working
|
|
434
|
+
directory
|
|
423
435
|
-V, --version show edir version
|
|
436
|
+
--conf just invoke your editor on your startup options
|
|
437
|
+
configuration file
|
|
424
438
|
|
|
425
439
|
Note you can set default starting options in ~/.config/edir-flags.conf. The
|
|
426
440
|
negation options (i.e. the --no-* options) allow you to temporarily override
|
|
@@ -471,7 +485,19 @@ class edir(Command):
|
|
|
471
485
|
## Use with Yazi File Manager
|
|
472
486
|
|
|
473
487
|
If you use [`yazi`][yazi] for your file manager then you don't need any special
|
|
474
|
-
configuration. Just type `:edir` from within [`yazi`][yazi]
|
|
488
|
+
configuration. Just type `:edir` from within [`yazi`][yazi] to edit all file
|
|
489
|
+
names in the current directory.
|
|
490
|
+
|
|
491
|
+
You can also replace the standard rename function (`r` key) in [`yazi`][yazi]
|
|
492
|
+
to use `edir` on selected files by adding the following to your
|
|
493
|
+
`~/.config/yazi/keymap.toml` file:
|
|
494
|
+
|
|
495
|
+
```toml
|
|
496
|
+
[[mgr.prepend_keymap]]
|
|
497
|
+
on = "r"
|
|
498
|
+
run = "shell --block -- edir -q %s"
|
|
499
|
+
desc = "Run edir on selected files/dirs"
|
|
500
|
+
```
|
|
475
501
|
|
|
476
502
|
## License
|
|
477
503
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: edir
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.35
|
|
4
4
|
Summary: Utility to rename, remove, and copy files/dirs using your editor
|
|
5
5
|
Author-email: Mark Blakeney <mark.blakeney@bullet-systems.net>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -186,7 +186,13 @@ following ways:
|
|
|
186
186
|
26. `vidir` returns an error when attempting to rename across different
|
|
187
187
|
file systems, which `edir` allows.
|
|
188
188
|
|
|
189
|
-
27. `edir`
|
|
189
|
+
27. By default, `edir` shows given paths relative to the current working
|
|
190
|
+
directory so that file names are shorter and easier to read/edit. `vidir`
|
|
191
|
+
shows absolute paths (if they are given like that on the command line, e.g.
|
|
192
|
+
by an external tool). You can disable this relative path behavior in `edir`
|
|
193
|
+
if you want.
|
|
194
|
+
|
|
195
|
+
28. `edir` always ensures editor line numbers have the same width (e.g.
|
|
190
196
|
`1` to `6` for 6 files, or `01` to `12` for 12 files, etc) so that
|
|
191
197
|
file names always line up justified. This facilitates block editing
|
|
192
198
|
of file names, e.g. using vim's [visual block
|
|
@@ -194,7 +200,7 @@ following ways:
|
|
|
194
200
|
do this so file names can be jagged wrt each other which makes block
|
|
195
201
|
editing awkward.
|
|
196
202
|
|
|
197
|
-
|
|
203
|
+
29. `edir` is very strict about the format of the lines you edit and
|
|
198
204
|
immediately exits with an error message (before changing anything)
|
|
199
205
|
if you format one of the lines incorrectly. All lines in the edited
|
|
200
206
|
list:
|
|
@@ -210,7 +216,7 @@ following ways:
|
|
|
210
216
|
line so an easy way to swap two file names is just to swap their
|
|
211
217
|
numbers.
|
|
212
218
|
|
|
213
|
-
|
|
219
|
+
30. `edir` always actions files consistently. The sequence of
|
|
214
220
|
operations applied is:
|
|
215
221
|
|
|
216
222
|
1. Deleted files are removed and all renamed files and directories
|
|
@@ -261,7 +267,7 @@ temporarily.
|
|
|
261
267
|
|
|
262
268
|
You can specify an alternative trash program, e.g.
|
|
263
269
|
[`trash-d`](https://github.com/rushsteve1/trash-d), or
|
|
264
|
-
[`gio trash`](https://man.archlinux.org/man/gio.1
|
|
270
|
+
[`gio trash`](https://man.archlinux.org/man/gio.1), or
|
|
265
271
|
[`gtrash put`](https://github.com/umlx5h/gtrash),
|
|
266
272
|
by setting the `--trash-program` option. Most likely you
|
|
267
273
|
want to set this as a [default option](#command-default-options).
|
|
@@ -339,12 +345,16 @@ command line arguments. Comments in the file (i.e. starting with a `#`)
|
|
|
339
345
|
are ignored. Type `edir -h` to see all [supported
|
|
340
346
|
options](#command-line-options).
|
|
341
347
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
+
Some options, e.g. `--recurse`, which can be set as a default option, provide
|
|
349
|
+
another "on-the-fly" negation option to temporarily override and disable the
|
|
350
|
+
default using the command line. E.g. use `-R` to override default `--recurse`.
|
|
351
|
+
See the usage summary for details.
|
|
352
|
+
|
|
353
|
+
You can conveniently edit your default options file using the `--conf` option:
|
|
354
|
+
|
|
355
|
+
```sh
|
|
356
|
+
$ edir --conf
|
|
357
|
+
```
|
|
348
358
|
|
|
349
359
|
## Examples
|
|
350
360
|
|
|
@@ -381,7 +391,7 @@ Type `edir -h` to view the usage summary:
|
|
|
381
391
|
usage: edir [-h] [-i] [-I] [-a] [-A] [-r] [-R] [-q] [-Q] [-G] [-g] [-t]
|
|
382
392
|
[-T] [--trash-program TRASH_PROGRAM] [-c] [-C] [-d DEPTH] [-F |
|
|
383
393
|
-D] [-L] [-N] [-M] [-S] [-O] [--OP OP] [-E] [-X] [-Y] [-Z]
|
|
384
|
-
[--suffix SUFFIX] [-V]
|
|
394
|
+
[--suffix SUFFIX] [--no-relative] [-V] [--conf]
|
|
385
395
|
[args ...]
|
|
386
396
|
|
|
387
397
|
Command line utility to rename, remove, or copy files and directories directly
|
|
@@ -434,7 +444,11 @@ options:
|
|
|
434
444
|
group directories last (including when sorted)
|
|
435
445
|
-Z, --no-group-dirs negate the options to group directories
|
|
436
446
|
--suffix SUFFIX specify suffix for temp editor file, default=".sh"
|
|
447
|
+
--no-relative do not forcibly show paths relative to current working
|
|
448
|
+
directory
|
|
437
449
|
-V, --version show edir version
|
|
450
|
+
--conf just invoke your editor on your startup options
|
|
451
|
+
configuration file
|
|
438
452
|
|
|
439
453
|
Note you can set default starting options in ~/.config/edir-flags.conf. The
|
|
440
454
|
negation options (i.e. the --no-* options) allow you to temporarily override
|
|
@@ -485,7 +499,19 @@ class edir(Command):
|
|
|
485
499
|
## Use with Yazi File Manager
|
|
486
500
|
|
|
487
501
|
If you use [`yazi`][yazi] for your file manager then you don't need any special
|
|
488
|
-
configuration. Just type `:edir` from within [`yazi`][yazi]
|
|
502
|
+
configuration. Just type `:edir` from within [`yazi`][yazi] to edit all file
|
|
503
|
+
names in the current directory.
|
|
504
|
+
|
|
505
|
+
You can also replace the standard rename function (`r` key) in [`yazi`][yazi]
|
|
506
|
+
to use `edir` on selected files by adding the following to your
|
|
507
|
+
`~/.config/yazi/keymap.toml` file:
|
|
508
|
+
|
|
509
|
+
```toml
|
|
510
|
+
[[mgr.prepend_keymap]]
|
|
511
|
+
on = "r"
|
|
512
|
+
run = "shell --block -- edir -q %s"
|
|
513
|
+
desc = "Run edir on selected files/dirs"
|
|
514
|
+
```
|
|
489
515
|
|
|
490
516
|
## License
|
|
491
517
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
edir
|
{edir-2.34 → edir-2.35}/edir.py
RENAMED
|
@@ -21,7 +21,6 @@ from collections.abc import Callable, Iterable, Sequence
|
|
|
21
21
|
from pathlib import Path
|
|
22
22
|
|
|
23
23
|
import argparse_from_file as argparse
|
|
24
|
-
import natsort
|
|
25
24
|
|
|
26
25
|
# Some constants
|
|
27
26
|
PROG = Path(sys.argv[0]).stem
|
|
@@ -54,15 +53,15 @@ COLOR_reset = '\033[39;49m'
|
|
|
54
53
|
args = argparse.Namespace()
|
|
55
54
|
gitfiles = set()
|
|
56
55
|
counts = [0, 0]
|
|
56
|
+
cwd = Path.cwd()
|
|
57
57
|
|
|
58
58
|
EDITORS = {'Windows': 'notepad', 'Darwin': 'open -e', 'default': 'vim'}
|
|
59
59
|
|
|
60
|
-
|
|
61
60
|
def get_default_editor() -> str:
|
|
62
61
|
"Return default editor for this system"
|
|
63
62
|
from platform import system
|
|
64
63
|
|
|
65
|
-
return EDITORS.get(system()
|
|
64
|
+
return EDITORS.get(system()) or EDITORS['default']
|
|
66
65
|
|
|
67
66
|
|
|
68
67
|
def make_editor_command(filename: str, sudo_user: str) -> tuple[str, list[str]]:
|
|
@@ -278,7 +277,7 @@ class Fpath:
|
|
|
278
277
|
except Exception as e:
|
|
279
278
|
return str(e)
|
|
280
279
|
try:
|
|
281
|
-
func(str(self.newpath), str(pathdest))
|
|
280
|
+
func(str(self.newpath), str(pathdest))
|
|
282
281
|
except Exception as e:
|
|
283
282
|
return str(e)
|
|
284
283
|
|
|
@@ -368,22 +367,24 @@ class Fpath:
|
|
|
368
367
|
@classmethod
|
|
369
368
|
def make_natsort_key(cls, optstr: str | None) -> None:
|
|
370
369
|
"Create natsort key function from given option string"
|
|
370
|
+
from natsort import natsort_keygen, ns
|
|
371
|
+
|
|
371
372
|
if optstr:
|
|
372
373
|
sep = '|' if '|' in optstr else ','
|
|
373
374
|
optval = 0
|
|
374
375
|
for opt in optstr.split(sep):
|
|
375
376
|
if opt := removeprefix(opt.strip().upper(), 'NS.'):
|
|
376
377
|
try:
|
|
377
|
-
nsval = getattr(
|
|
378
|
+
nsval = getattr(ns, opt)
|
|
378
379
|
except AttributeError as e:
|
|
379
380
|
sys.exit(f'ERROR: invalid natsort option: {str(e)}')
|
|
380
381
|
|
|
381
382
|
if nsval and isinstance(nsval, int):
|
|
382
383
|
optval |= nsval
|
|
383
384
|
|
|
384
|
-
cls.natsort_key =
|
|
385
|
+
cls.natsort_key = natsort_keygen(key=lambda x: x.repr, alg=optval)
|
|
385
386
|
else:
|
|
386
|
-
cls.natsort_key =
|
|
387
|
+
cls.natsort_key = natsort_keygen(key=lambda x: x.repr)
|
|
387
388
|
|
|
388
389
|
@classmethod
|
|
389
390
|
def remove_temps(cls) -> None:
|
|
@@ -414,9 +415,17 @@ class Fpath:
|
|
|
414
415
|
def add(cls, name: str, depth: int) -> None:
|
|
415
416
|
"Add file[s]/dir[s] to the list of paths"
|
|
416
417
|
path = Path(name)
|
|
418
|
+
|
|
417
419
|
if not path.exists():
|
|
418
420
|
sys.exit(f'ERROR: {name} does not exist')
|
|
419
421
|
|
|
422
|
+
if not args.no_relative:
|
|
423
|
+
# Make path relative to current working dir if possible
|
|
424
|
+
try:
|
|
425
|
+
path = path.relative_to(cwd)
|
|
426
|
+
except ValueError:
|
|
427
|
+
pass
|
|
428
|
+
|
|
420
429
|
if path.is_dir():
|
|
421
430
|
for child in find_in_dir(path, depth, args.all):
|
|
422
431
|
cls.append(child)
|
|
@@ -738,9 +747,19 @@ def main() -> int:
|
|
|
738
747
|
default=SUFFIX,
|
|
739
748
|
help='specify suffix for temp editor file, default="%(default)s"',
|
|
740
749
|
)
|
|
750
|
+
opt.add_argument(
|
|
751
|
+
'--no-relative',
|
|
752
|
+
action='store_true',
|
|
753
|
+
help='do not forcibly show paths relative to current working directory',
|
|
754
|
+
)
|
|
741
755
|
opt.add_argument(
|
|
742
756
|
'-V', '--version', action='store_true', help=f'show {PROG} version'
|
|
743
757
|
)
|
|
758
|
+
opt.add_argument(
|
|
759
|
+
'--conf',
|
|
760
|
+
action='store_true',
|
|
761
|
+
help='just invoke your editor on your startup options configuration file',
|
|
762
|
+
)
|
|
744
763
|
opt.add_argument('args', nargs='*', help='file|dir, or "-" for stdin')
|
|
745
764
|
|
|
746
765
|
args = opt.parse_args()
|
|
@@ -756,9 +775,31 @@ def main() -> int:
|
|
|
756
775
|
print(ver)
|
|
757
776
|
return 0
|
|
758
777
|
|
|
778
|
+
if args.conf:
|
|
779
|
+
# Edit the configuration file and exit
|
|
780
|
+
if not (conf_file := opt.from_file_path):
|
|
781
|
+
opt.error('No configuration file path determined.')
|
|
782
|
+
return 1
|
|
783
|
+
|
|
784
|
+
conf_file.parent.mkdir(parents=True, exist_ok=True)
|
|
785
|
+
|
|
786
|
+
if not conf_file.is_file() or conf_file.stat().st_size == 0:
|
|
787
|
+
conf_file.write_text(
|
|
788
|
+
'# Add your default edir options, one option per line. Comments are ignored.\n'
|
|
789
|
+
)
|
|
790
|
+
|
|
791
|
+
editor = os.getenv('EDITOR') or get_default_editor()
|
|
792
|
+
editfile(editor, [editor, str(conf_file)])
|
|
793
|
+
|
|
794
|
+
# Remove the edited config file if it is empty
|
|
795
|
+
if conf_file.is_file() and conf_file.stat().st_size == 0:
|
|
796
|
+
conf_file.unlink()
|
|
797
|
+
|
|
798
|
+
return 0
|
|
799
|
+
|
|
759
800
|
if args.trash:
|
|
760
801
|
if not args.trash_program:
|
|
761
|
-
opt.error('must specify trash program with --trash-program option')
|
|
802
|
+
opt.error('must specify trash program with --trash-program option.')
|
|
762
803
|
|
|
763
804
|
args.trash_program = args.trash_program.split()
|
|
764
805
|
|
|
@@ -771,7 +812,7 @@ def main() -> int:
|
|
|
771
812
|
gitfiles.update(out.splitlines())
|
|
772
813
|
|
|
773
814
|
if args.git and not gitfiles:
|
|
774
|
-
opt.error('must be within a git repo to use -g/--git option')
|
|
815
|
+
opt.error('must be within a git repo to use -g/--git option.')
|
|
775
816
|
|
|
776
817
|
# Set input list to a combination of arguments and stdin
|
|
777
818
|
filelist = args.args
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
tmp
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{edir-2.34 → edir-2.35}/justfile
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|