edir 2.29__tar.gz → 2.30__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.29 → edir-2.30}/Makefile +1 -1
- {edir-2.29/edir.egg-info → edir-2.30}/PKG-INFO +53 -40
- {edir-2.29 → edir-2.30}/README.md +52 -39
- {edir-2.29 → edir-2.30/edir.egg-info}/PKG-INFO +53 -40
- {edir-2.29 → edir-2.30}/edir.py +36 -24
- {edir-2.29 → edir-2.30}/.flake8 +0 -0
- {edir-2.29 → edir-2.30}/.gitignore +0 -0
- {edir-2.29 → edir-2.30}/edir.egg-info/SOURCES.txt +0 -0
- {edir-2.29 → edir-2.30}/edir.egg-info/dependency_links.txt +0 -0
- {edir-2.29 → edir-2.30}/edir.egg-info/entry_points.txt +0 -0
- {edir-2.29 → edir-2.30}/edir.egg-info/requires.txt +0 -0
- {edir-2.29 → edir-2.30}/edir.egg-info/top_level.txt +0 -0
- {edir-2.29 → edir-2.30}/pyproject.toml +0 -0
- {edir-2.29 → edir-2.30}/setup.cfg +0 -0
{edir-2.29 → edir-2.30}/Makefile
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: edir
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.30
|
|
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: GPLv3
|
|
@@ -15,16 +15,16 @@ Requires-Dist: platformdirs
|
|
|
15
15
|
[](https://pypi.org/project/edir/)
|
|
16
16
|
[](https://aur.archlinux.org/packages/edir/)
|
|
17
17
|
|
|
18
|
-
[edir]
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
[edir][edir] is a command line utility to rename, remove, and copy
|
|
19
|
+
filenames and directories using your text editor. Run it in the current
|
|
20
|
+
directory and `edir` will open your editor on a list of files and
|
|
21
|
+
directories in that directory. Each item in the directory will appear on
|
|
22
|
+
its own numbered line. These numbers are how `edir` keeps track of what
|
|
23
|
+
items are changed. Delete lines to remove files/directories, edit lines
|
|
24
|
+
to rename files/directories, or duplicate line numbers to copy
|
|
25
|
+
files/directories. You can also switch pairs of numbers to swap files or
|
|
26
|
+
directories. If run from within a [Git](https://git-scm.com/)
|
|
27
|
+
repository, `edir` will [use
|
|
28
28
|
Git](#renames-and-deletes-in-a-git-repository) to rename or remove
|
|
29
29
|
tracked files/directories. You can use a [trash program](#using-trash)
|
|
30
30
|
to remove files.
|
|
@@ -34,10 +34,10 @@ https://github.com/bulletmark/edir.
|
|
|
34
34
|
|
|
35
35
|
## Advantages Compared to Vidir
|
|
36
36
|
|
|
37
|
-
[edir]
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
the following ways:
|
|
37
|
+
[edir][edir] unashamedly mimics the functionality of the
|
|
38
|
+
[vidir](https://linux.die.net/man/1/vidir) utility from
|
|
39
|
+
[moreutils](https://joeyh.name/code/moreutils/) but aims to improve it
|
|
40
|
+
in the following ways:
|
|
41
41
|
|
|
42
42
|
1. `edir` automatically uses `git mv` instead of `mv` and `git rm`
|
|
43
43
|
instead of `rm` for tracked files when invoked within a
|
|
@@ -72,11 +72,12 @@ the following ways:
|
|
|
72
72
|
directory `c` to `e`.
|
|
73
73
|
|
|
74
74
|
Note also, that both `edir` and `vidir` show the leading `./` on each
|
|
75
|
-
entry so that any leading spaces are clearly seen,
|
|
75
|
+
entry so that any leading spaces on the filename are clearly seen,
|
|
76
|
+
and can be edited.
|
|
76
77
|
|
|
77
78
|
3. `edir` adds the ability to copy files or directories one or more
|
|
78
|
-
times when you duplicate a numbered line
|
|
79
|
-
functionality.
|
|
79
|
+
times when you duplicate a numbered line (after the original).
|
|
80
|
+
`vidir` does not have copy functionality.
|
|
80
81
|
|
|
81
82
|
4. `edir` allows you to remove a file/directory by deleting the line, as
|
|
82
83
|
`vidir` does, but you can also remove it by pre-pending a `#` to
|
|
@@ -124,9 +125,11 @@ the following ways:
|
|
|
124
125
|
|
|
125
126
|
13. `edir` adds a `-L/--nolinks` option to ignore symbolic links.
|
|
126
127
|
|
|
127
|
-
14. `edir` adds a `-d/--
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
14. `edir` adds a `-d/--depth` option to edit to the specified directory
|
|
129
|
+
depth. The default is 1 so `edir a` (if a is a directory) will edit
|
|
130
|
+
names to `a/*`, `edir -d2 a` will edit names to `a/*/*`, etc. `edir
|
|
131
|
+
-d0 a` will just edit the `a` name directly. Can specify `-1` to
|
|
132
|
+
edit to all depths (or use a large positive number).
|
|
130
133
|
|
|
131
134
|
15. `edir` adds a [`-t/--trash` option](#using-trash) to remove to your
|
|
132
135
|
[Trash](https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html).
|
|
@@ -290,12 +293,13 @@ where:
|
|
|
290
293
|
|
|
291
294
|
## Installation or Upgrade
|
|
292
295
|
|
|
293
|
-
Arch users can install [edir
|
|
296
|
+
Python 3.8 or later is required. Arch Linux users can install [`edir`
|
|
297
|
+
from the AUR](https://aur.archlinux.org/packages/edir) and skip this
|
|
298
|
+
section.
|
|
294
299
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
[
|
|
298
|
-
following:
|
|
300
|
+
The easiest way to install `edir` is to use [`pipx`][pipx] (or
|
|
301
|
+
[`pipxu`][pipxu], or [`uv tool`][uvtool]) which installs [`edir` from
|
|
302
|
+
PyPi][edirpy]. To install:
|
|
299
303
|
|
|
300
304
|
```
|
|
301
305
|
$ pipx install edir
|
|
@@ -370,8 +374,9 @@ Type `edir -h` to view the usage summary:
|
|
|
370
374
|
|
|
371
375
|
```
|
|
372
376
|
usage: edir [-h] [-i] [-I] [-a] [-A] [-r] [-R] [-q] [-Q] [-G] [-g] [-t]
|
|
373
|
-
[-T] [--trash-program TRASH_PROGRAM] [-c] [-C] [-d
|
|
374
|
-
[-L] [-N] [-M] [-S] [-E] [-X] [-Y] [-Z]
|
|
377
|
+
[-T] [--trash-program TRASH_PROGRAM] [-c] [-C] [-d DEPTH]
|
|
378
|
+
[-F | -D] [-L] [-N] [-M] [-S] [-E] [-X] [-Y] [-Z]
|
|
379
|
+
[--suffix SUFFIX] [-V]
|
|
375
380
|
[args ...]
|
|
376
381
|
|
|
377
382
|
Program to rename, remove, or copy files and directories using your editor.
|
|
@@ -401,8 +406,8 @@ options:
|
|
|
401
406
|
-c, --no-color do not color rename/remove/copy messages
|
|
402
407
|
-C, --no-invert-color
|
|
403
408
|
do not invert the color to highlight error messages
|
|
404
|
-
-d, --
|
|
405
|
-
|
|
409
|
+
-d DEPTH, --depth DEPTH
|
|
410
|
+
edit paths to specified depth, default=1
|
|
406
411
|
-F, --files only show/edit files
|
|
407
412
|
-D, --dirs only show/edit directories
|
|
408
413
|
-L, --nolinks ignore all symlinks
|
|
@@ -426,7 +431,7 @@ shortforms) allow you to temporarily override your defaults.
|
|
|
426
431
|
## Embed in Ranger File Manager
|
|
427
432
|
|
|
428
433
|
In many ways `edir` (and `vidir`) is better than the
|
|
429
|
-
[ranger](https://ranger.github.io/)
|
|
434
|
+
[ranger](https://ranger.github.io/) terminal file manager
|
|
430
435
|
[bulkrename](https://github.com/ranger/ranger/wiki/Official-user-guide#bulk-renaming)
|
|
431
436
|
command which does not handle name swaps and clashes etc. To add `edir`
|
|
432
437
|
as a command within [ranger](https://ranger.github.io/), add or create
|
|
@@ -449,17 +454,25 @@ class edir(Command):
|
|
|
449
454
|
return self._tab_directory_content()
|
|
450
455
|
```
|
|
451
456
|
|
|
457
|
+
Note if you use [yazi](https://yazi-rs.github.io/) for your file manager
|
|
458
|
+
you don't need any special configuration in `yazi`. Just type `:edir`.
|
|
459
|
+
|
|
452
460
|
## License
|
|
453
461
|
|
|
454
462
|
Copyright (C) 2019 Mark Blakeney. This program is distributed under the
|
|
455
|
-
terms of the GNU General Public License.
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
463
|
+
terms of the GNU General Public License. This program is free software:
|
|
464
|
+
you can redistribute it and/or modify it under the terms of the GNU
|
|
465
|
+
General Public License as published by the Free Software Foundation,
|
|
466
|
+
either version 3 of the License, or any later version. This program is
|
|
467
|
+
distributed in the hope that it will be useful, but WITHOUT ANY
|
|
468
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
469
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at
|
|
470
|
+
<http://www.gnu.org/licenses/> for more details.
|
|
471
|
+
|
|
472
|
+
[edir]: https://github.com/bulletmark/edir
|
|
473
|
+
[edirpy]: https://pypi.org/project/edir
|
|
474
|
+
[pipx]: https://github.com/pypa/pipx
|
|
475
|
+
[pipxu]: https://github.com/bulletmark/pipxu
|
|
476
|
+
[uvtool]: https://docs.astral.sh/uv/guides/tools/#installing-tools
|
|
464
477
|
|
|
465
478
|
<!-- vim: se ai syn=markdown: -->
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
[](https://pypi.org/project/edir/)
|
|
3
3
|
[](https://aur.archlinux.org/packages/edir/)
|
|
4
4
|
|
|
5
|
-
[edir]
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
[edir][edir] is a command line utility to rename, remove, and copy
|
|
6
|
+
filenames and directories using your text editor. Run it in the current
|
|
7
|
+
directory and `edir` will open your editor on a list of files and
|
|
8
|
+
directories in that directory. Each item in the directory will appear on
|
|
9
|
+
its own numbered line. These numbers are how `edir` keeps track of what
|
|
10
|
+
items are changed. Delete lines to remove files/directories, edit lines
|
|
11
|
+
to rename files/directories, or duplicate line numbers to copy
|
|
12
|
+
files/directories. You can also switch pairs of numbers to swap files or
|
|
13
|
+
directories. If run from within a [Git](https://git-scm.com/)
|
|
14
|
+
repository, `edir` will [use
|
|
15
15
|
Git](#renames-and-deletes-in-a-git-repository) to rename or remove
|
|
16
16
|
tracked files/directories. You can use a [trash program](#using-trash)
|
|
17
17
|
to remove files.
|
|
@@ -21,10 +21,10 @@ https://github.com/bulletmark/edir.
|
|
|
21
21
|
|
|
22
22
|
## Advantages Compared to Vidir
|
|
23
23
|
|
|
24
|
-
[edir]
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
the following ways:
|
|
24
|
+
[edir][edir] unashamedly mimics the functionality of the
|
|
25
|
+
[vidir](https://linux.die.net/man/1/vidir) utility from
|
|
26
|
+
[moreutils](https://joeyh.name/code/moreutils/) but aims to improve it
|
|
27
|
+
in the following ways:
|
|
28
28
|
|
|
29
29
|
1. `edir` automatically uses `git mv` instead of `mv` and `git rm`
|
|
30
30
|
instead of `rm` for tracked files when invoked within a
|
|
@@ -59,11 +59,12 @@ the following ways:
|
|
|
59
59
|
directory `c` to `e`.
|
|
60
60
|
|
|
61
61
|
Note also, that both `edir` and `vidir` show the leading `./` on each
|
|
62
|
-
entry so that any leading spaces are clearly seen,
|
|
62
|
+
entry so that any leading spaces on the filename are clearly seen,
|
|
63
|
+
and can be edited.
|
|
63
64
|
|
|
64
65
|
3. `edir` adds the ability to copy files or directories one or more
|
|
65
|
-
times when you duplicate a numbered line
|
|
66
|
-
functionality.
|
|
66
|
+
times when you duplicate a numbered line (after the original).
|
|
67
|
+
`vidir` does not have copy functionality.
|
|
67
68
|
|
|
68
69
|
4. `edir` allows you to remove a file/directory by deleting the line, as
|
|
69
70
|
`vidir` does, but you can also remove it by pre-pending a `#` to
|
|
@@ -111,9 +112,11 @@ the following ways:
|
|
|
111
112
|
|
|
112
113
|
13. `edir` adds a `-L/--nolinks` option to ignore symbolic links.
|
|
113
114
|
|
|
114
|
-
14. `edir` adds a `-d/--
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
14. `edir` adds a `-d/--depth` option to edit to the specified directory
|
|
116
|
+
depth. The default is 1 so `edir a` (if a is a directory) will edit
|
|
117
|
+
names to `a/*`, `edir -d2 a` will edit names to `a/*/*`, etc. `edir
|
|
118
|
+
-d0 a` will just edit the `a` name directly. Can specify `-1` to
|
|
119
|
+
edit to all depths (or use a large positive number).
|
|
117
120
|
|
|
118
121
|
15. `edir` adds a [`-t/--trash` option](#using-trash) to remove to your
|
|
119
122
|
[Trash](https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html).
|
|
@@ -277,12 +280,13 @@ where:
|
|
|
277
280
|
|
|
278
281
|
## Installation or Upgrade
|
|
279
282
|
|
|
280
|
-
Arch users can install [edir
|
|
283
|
+
Python 3.8 or later is required. Arch Linux users can install [`edir`
|
|
284
|
+
from the AUR](https://aur.archlinux.org/packages/edir) and skip this
|
|
285
|
+
section.
|
|
281
286
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
[
|
|
285
|
-
following:
|
|
287
|
+
The easiest way to install `edir` is to use [`pipx`][pipx] (or
|
|
288
|
+
[`pipxu`][pipxu], or [`uv tool`][uvtool]) which installs [`edir` from
|
|
289
|
+
PyPi][edirpy]. To install:
|
|
286
290
|
|
|
287
291
|
```
|
|
288
292
|
$ pipx install edir
|
|
@@ -357,8 +361,9 @@ Type `edir -h` to view the usage summary:
|
|
|
357
361
|
|
|
358
362
|
```
|
|
359
363
|
usage: edir [-h] [-i] [-I] [-a] [-A] [-r] [-R] [-q] [-Q] [-G] [-g] [-t]
|
|
360
|
-
[-T] [--trash-program TRASH_PROGRAM] [-c] [-C] [-d
|
|
361
|
-
[-L] [-N] [-M] [-S] [-E] [-X] [-Y] [-Z]
|
|
364
|
+
[-T] [--trash-program TRASH_PROGRAM] [-c] [-C] [-d DEPTH]
|
|
365
|
+
[-F | -D] [-L] [-N] [-M] [-S] [-E] [-X] [-Y] [-Z]
|
|
366
|
+
[--suffix SUFFIX] [-V]
|
|
362
367
|
[args ...]
|
|
363
368
|
|
|
364
369
|
Program to rename, remove, or copy files and directories using your editor.
|
|
@@ -388,8 +393,8 @@ options:
|
|
|
388
393
|
-c, --no-color do not color rename/remove/copy messages
|
|
389
394
|
-C, --no-invert-color
|
|
390
395
|
do not invert the color to highlight error messages
|
|
391
|
-
-d, --
|
|
392
|
-
|
|
396
|
+
-d DEPTH, --depth DEPTH
|
|
397
|
+
edit paths to specified depth, default=1
|
|
393
398
|
-F, --files only show/edit files
|
|
394
399
|
-D, --dirs only show/edit directories
|
|
395
400
|
-L, --nolinks ignore all symlinks
|
|
@@ -413,7 +418,7 @@ shortforms) allow you to temporarily override your defaults.
|
|
|
413
418
|
## Embed in Ranger File Manager
|
|
414
419
|
|
|
415
420
|
In many ways `edir` (and `vidir`) is better than the
|
|
416
|
-
[ranger](https://ranger.github.io/)
|
|
421
|
+
[ranger](https://ranger.github.io/) terminal file manager
|
|
417
422
|
[bulkrename](https://github.com/ranger/ranger/wiki/Official-user-guide#bulk-renaming)
|
|
418
423
|
command which does not handle name swaps and clashes etc. To add `edir`
|
|
419
424
|
as a command within [ranger](https://ranger.github.io/), add or create
|
|
@@ -436,17 +441,25 @@ class edir(Command):
|
|
|
436
441
|
return self._tab_directory_content()
|
|
437
442
|
```
|
|
438
443
|
|
|
444
|
+
Note if you use [yazi](https://yazi-rs.github.io/) for your file manager
|
|
445
|
+
you don't need any special configuration in `yazi`. Just type `:edir`.
|
|
446
|
+
|
|
439
447
|
## License
|
|
440
448
|
|
|
441
449
|
Copyright (C) 2019 Mark Blakeney. This program is distributed under the
|
|
442
|
-
terms of the GNU General Public License.
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
450
|
+
terms of the GNU General Public License. This program is free software:
|
|
451
|
+
you can redistribute it and/or modify it under the terms of the GNU
|
|
452
|
+
General Public License as published by the Free Software Foundation,
|
|
453
|
+
either version 3 of the License, or any later version. This program is
|
|
454
|
+
distributed in the hope that it will be useful, but WITHOUT ANY
|
|
455
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
456
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at
|
|
457
|
+
<http://www.gnu.org/licenses/> for more details.
|
|
458
|
+
|
|
459
|
+
[edir]: https://github.com/bulletmark/edir
|
|
460
|
+
[edirpy]: https://pypi.org/project/edir
|
|
461
|
+
[pipx]: https://github.com/pypa/pipx
|
|
462
|
+
[pipxu]: https://github.com/bulletmark/pipxu
|
|
463
|
+
[uvtool]: https://docs.astral.sh/uv/guides/tools/#installing-tools
|
|
451
464
|
|
|
452
465
|
<!-- vim: se ai syn=markdown: -->
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: edir
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.30
|
|
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: GPLv3
|
|
@@ -15,16 +15,16 @@ Requires-Dist: platformdirs
|
|
|
15
15
|
[](https://pypi.org/project/edir/)
|
|
16
16
|
[](https://aur.archlinux.org/packages/edir/)
|
|
17
17
|
|
|
18
|
-
[edir]
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
[edir][edir] is a command line utility to rename, remove, and copy
|
|
19
|
+
filenames and directories using your text editor. Run it in the current
|
|
20
|
+
directory and `edir` will open your editor on a list of files and
|
|
21
|
+
directories in that directory. Each item in the directory will appear on
|
|
22
|
+
its own numbered line. These numbers are how `edir` keeps track of what
|
|
23
|
+
items are changed. Delete lines to remove files/directories, edit lines
|
|
24
|
+
to rename files/directories, or duplicate line numbers to copy
|
|
25
|
+
files/directories. You can also switch pairs of numbers to swap files or
|
|
26
|
+
directories. If run from within a [Git](https://git-scm.com/)
|
|
27
|
+
repository, `edir` will [use
|
|
28
28
|
Git](#renames-and-deletes-in-a-git-repository) to rename or remove
|
|
29
29
|
tracked files/directories. You can use a [trash program](#using-trash)
|
|
30
30
|
to remove files.
|
|
@@ -34,10 +34,10 @@ https://github.com/bulletmark/edir.
|
|
|
34
34
|
|
|
35
35
|
## Advantages Compared to Vidir
|
|
36
36
|
|
|
37
|
-
[edir]
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
the following ways:
|
|
37
|
+
[edir][edir] unashamedly mimics the functionality of the
|
|
38
|
+
[vidir](https://linux.die.net/man/1/vidir) utility from
|
|
39
|
+
[moreutils](https://joeyh.name/code/moreutils/) but aims to improve it
|
|
40
|
+
in the following ways:
|
|
41
41
|
|
|
42
42
|
1. `edir` automatically uses `git mv` instead of `mv` and `git rm`
|
|
43
43
|
instead of `rm` for tracked files when invoked within a
|
|
@@ -72,11 +72,12 @@ the following ways:
|
|
|
72
72
|
directory `c` to `e`.
|
|
73
73
|
|
|
74
74
|
Note also, that both `edir` and `vidir` show the leading `./` on each
|
|
75
|
-
entry so that any leading spaces are clearly seen,
|
|
75
|
+
entry so that any leading spaces on the filename are clearly seen,
|
|
76
|
+
and can be edited.
|
|
76
77
|
|
|
77
78
|
3. `edir` adds the ability to copy files or directories one or more
|
|
78
|
-
times when you duplicate a numbered line
|
|
79
|
-
functionality.
|
|
79
|
+
times when you duplicate a numbered line (after the original).
|
|
80
|
+
`vidir` does not have copy functionality.
|
|
80
81
|
|
|
81
82
|
4. `edir` allows you to remove a file/directory by deleting the line, as
|
|
82
83
|
`vidir` does, but you can also remove it by pre-pending a `#` to
|
|
@@ -124,9 +125,11 @@ the following ways:
|
|
|
124
125
|
|
|
125
126
|
13. `edir` adds a `-L/--nolinks` option to ignore symbolic links.
|
|
126
127
|
|
|
127
|
-
14. `edir` adds a `-d/--
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
14. `edir` adds a `-d/--depth` option to edit to the specified directory
|
|
129
|
+
depth. The default is 1 so `edir a` (if a is a directory) will edit
|
|
130
|
+
names to `a/*`, `edir -d2 a` will edit names to `a/*/*`, etc. `edir
|
|
131
|
+
-d0 a` will just edit the `a` name directly. Can specify `-1` to
|
|
132
|
+
edit to all depths (or use a large positive number).
|
|
130
133
|
|
|
131
134
|
15. `edir` adds a [`-t/--trash` option](#using-trash) to remove to your
|
|
132
135
|
[Trash](https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html).
|
|
@@ -290,12 +293,13 @@ where:
|
|
|
290
293
|
|
|
291
294
|
## Installation or Upgrade
|
|
292
295
|
|
|
293
|
-
Arch users can install [edir
|
|
296
|
+
Python 3.8 or later is required. Arch Linux users can install [`edir`
|
|
297
|
+
from the AUR](https://aur.archlinux.org/packages/edir) and skip this
|
|
298
|
+
section.
|
|
294
299
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
[
|
|
298
|
-
following:
|
|
300
|
+
The easiest way to install `edir` is to use [`pipx`][pipx] (or
|
|
301
|
+
[`pipxu`][pipxu], or [`uv tool`][uvtool]) which installs [`edir` from
|
|
302
|
+
PyPi][edirpy]. To install:
|
|
299
303
|
|
|
300
304
|
```
|
|
301
305
|
$ pipx install edir
|
|
@@ -370,8 +374,9 @@ Type `edir -h` to view the usage summary:
|
|
|
370
374
|
|
|
371
375
|
```
|
|
372
376
|
usage: edir [-h] [-i] [-I] [-a] [-A] [-r] [-R] [-q] [-Q] [-G] [-g] [-t]
|
|
373
|
-
[-T] [--trash-program TRASH_PROGRAM] [-c] [-C] [-d
|
|
374
|
-
[-L] [-N] [-M] [-S] [-E] [-X] [-Y] [-Z]
|
|
377
|
+
[-T] [--trash-program TRASH_PROGRAM] [-c] [-C] [-d DEPTH]
|
|
378
|
+
[-F | -D] [-L] [-N] [-M] [-S] [-E] [-X] [-Y] [-Z]
|
|
379
|
+
[--suffix SUFFIX] [-V]
|
|
375
380
|
[args ...]
|
|
376
381
|
|
|
377
382
|
Program to rename, remove, or copy files and directories using your editor.
|
|
@@ -401,8 +406,8 @@ options:
|
|
|
401
406
|
-c, --no-color do not color rename/remove/copy messages
|
|
402
407
|
-C, --no-invert-color
|
|
403
408
|
do not invert the color to highlight error messages
|
|
404
|
-
-d, --
|
|
405
|
-
|
|
409
|
+
-d DEPTH, --depth DEPTH
|
|
410
|
+
edit paths to specified depth, default=1
|
|
406
411
|
-F, --files only show/edit files
|
|
407
412
|
-D, --dirs only show/edit directories
|
|
408
413
|
-L, --nolinks ignore all symlinks
|
|
@@ -426,7 +431,7 @@ shortforms) allow you to temporarily override your defaults.
|
|
|
426
431
|
## Embed in Ranger File Manager
|
|
427
432
|
|
|
428
433
|
In many ways `edir` (and `vidir`) is better than the
|
|
429
|
-
[ranger](https://ranger.github.io/)
|
|
434
|
+
[ranger](https://ranger.github.io/) terminal file manager
|
|
430
435
|
[bulkrename](https://github.com/ranger/ranger/wiki/Official-user-guide#bulk-renaming)
|
|
431
436
|
command which does not handle name swaps and clashes etc. To add `edir`
|
|
432
437
|
as a command within [ranger](https://ranger.github.io/), add or create
|
|
@@ -449,17 +454,25 @@ class edir(Command):
|
|
|
449
454
|
return self._tab_directory_content()
|
|
450
455
|
```
|
|
451
456
|
|
|
457
|
+
Note if you use [yazi](https://yazi-rs.github.io/) for your file manager
|
|
458
|
+
you don't need any special configuration in `yazi`. Just type `:edir`.
|
|
459
|
+
|
|
452
460
|
## License
|
|
453
461
|
|
|
454
462
|
Copyright (C) 2019 Mark Blakeney. This program is distributed under the
|
|
455
|
-
terms of the GNU General Public License.
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
463
|
+
terms of the GNU General Public License. This program is free software:
|
|
464
|
+
you can redistribute it and/or modify it under the terms of the GNU
|
|
465
|
+
General Public License as published by the Free Software Foundation,
|
|
466
|
+
either version 3 of the License, or any later version. This program is
|
|
467
|
+
distributed in the hope that it will be useful, but WITHOUT ANY
|
|
468
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
469
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at
|
|
470
|
+
<http://www.gnu.org/licenses/> for more details.
|
|
471
|
+
|
|
472
|
+
[edir]: https://github.com/bulletmark/edir
|
|
473
|
+
[edirpy]: https://pypi.org/project/edir
|
|
474
|
+
[pipx]: https://github.com/pypa/pipx
|
|
475
|
+
[pipxu]: https://github.com/bulletmark/pipxu
|
|
476
|
+
[uvtool]: https://docs.astral.sh/uv/guides/tools/#installing-tools
|
|
464
477
|
|
|
465
478
|
<!-- vim: se ai syn=markdown: -->
|
{edir-2.29 → edir-2.30}/edir.py
RENAMED
|
@@ -5,6 +5,8 @@ editor. Will use git to action the rename and remove if run within a git
|
|
|
5
5
|
repository.
|
|
6
6
|
'''
|
|
7
7
|
# Author: Mark Blakeney, May 2019.
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
8
10
|
import argparse
|
|
9
11
|
import itertools
|
|
10
12
|
import os
|
|
@@ -16,7 +18,7 @@ import sys
|
|
|
16
18
|
import tempfile
|
|
17
19
|
from collections import OrderedDict
|
|
18
20
|
from pathlib import Path
|
|
19
|
-
from typing import
|
|
21
|
+
from typing import Callable, Sequence, Iterable
|
|
20
22
|
|
|
21
23
|
from platformdirs import user_config_path
|
|
22
24
|
|
|
@@ -71,7 +73,7 @@ def editfile(filename: Path) -> None:
|
|
|
71
73
|
if res.returncode != 0:
|
|
72
74
|
sys.exit(f'ERROR: {editor} returned error {res.returncode}')
|
|
73
75
|
|
|
74
|
-
def log(action: str, msg: str, error:
|
|
76
|
+
def log(action: str, msg: str, error: str | None = None, *,
|
|
75
77
|
prompt: bool = False) -> None:
|
|
76
78
|
'Output message with appropriate color'
|
|
77
79
|
counts[bool(error)] += 1
|
|
@@ -93,7 +95,7 @@ def log(action: str, msg: str, error: Optional[str] = None, *,
|
|
|
93
95
|
|
|
94
96
|
print(msg, file=out)
|
|
95
97
|
|
|
96
|
-
def run(cmd: Sequence[str]) ->
|
|
98
|
+
def run(cmd: Sequence[str]) -> tuple[str, str]:
|
|
97
99
|
'Run given command and return (stdout, stderr) strings'
|
|
98
100
|
stdout = ''
|
|
99
101
|
stderr = ''
|
|
@@ -111,7 +113,7 @@ def run(cmd: Sequence[str]) -> Tuple[str, str]:
|
|
|
111
113
|
return stdout, stderr
|
|
112
114
|
|
|
113
115
|
def remove(path: Path, git: bool = False, trash: bool = False,
|
|
114
|
-
recurse: bool = False) ->
|
|
116
|
+
recurse: bool = False) -> str | None:
|
|
115
117
|
'Delete given file/directory'
|
|
116
118
|
if not recurse and not path.is_symlink() and path.is_dir() and \
|
|
117
119
|
any(path.iterdir()):
|
|
@@ -172,6 +174,19 @@ def create_prompt(options: str) -> str:
|
|
|
172
174
|
words.append('/'.join(subwords))
|
|
173
175
|
return ', '.join(words) + ': [' + '|'.join(letters) + ']? '
|
|
174
176
|
|
|
177
|
+
def find_in_dir(path: Path, depth: int, allfiles: bool) -> Iterable[Path]:
|
|
178
|
+
'Find files/dirs in given path'
|
|
179
|
+
if depth == 0:
|
|
180
|
+
yield path
|
|
181
|
+
return
|
|
182
|
+
|
|
183
|
+
for p in sorted(path.iterdir()):
|
|
184
|
+
if allfiles or not p.name.startswith('.'):
|
|
185
|
+
if not p.is_dir() or depth == 1:
|
|
186
|
+
yield p
|
|
187
|
+
else:
|
|
188
|
+
yield from find_in_dir(p, depth - 1, allfiles)
|
|
189
|
+
|
|
175
190
|
class Fpath:
|
|
176
191
|
'Class to manage each instance of a file/dir'
|
|
177
192
|
paths = []
|
|
@@ -183,7 +198,7 @@ class Fpath:
|
|
|
183
198
|
self.newpath = None
|
|
184
199
|
self.temppath = None
|
|
185
200
|
self.note = ''
|
|
186
|
-
self.copies:
|
|
201
|
+
self.copies: list[Path] = []
|
|
187
202
|
try:
|
|
188
203
|
self.is_dir = path.is_dir() and not path.is_symlink()
|
|
189
204
|
except Exception as e:
|
|
@@ -212,7 +227,7 @@ class Fpath:
|
|
|
212
227
|
|
|
213
228
|
return path
|
|
214
229
|
|
|
215
|
-
def copy(self, pathdest: Path) ->
|
|
230
|
+
def copy(self, pathdest: Path) -> str | None:
|
|
216
231
|
'Copy given pathsrc to pathdest'
|
|
217
232
|
if self.is_dir:
|
|
218
233
|
func: Callable = shutil.copytree
|
|
@@ -229,7 +244,7 @@ class Fpath:
|
|
|
229
244
|
except Exception as e:
|
|
230
245
|
return str(e)
|
|
231
246
|
|
|
232
|
-
def rename_temp(self) ->
|
|
247
|
+
def rename_temp(self) -> str | None:
|
|
233
248
|
'Move this path to a temp place in advance of final move'
|
|
234
249
|
if not self.newpath:
|
|
235
250
|
return None
|
|
@@ -248,7 +263,7 @@ class Fpath:
|
|
|
248
263
|
|
|
249
264
|
return err
|
|
250
265
|
|
|
251
|
-
def restore_temp(self) ->
|
|
266
|
+
def restore_temp(self) -> str | None:
|
|
252
267
|
'Restore temp path to final destination'
|
|
253
268
|
if not self.temppath or not self.newpath:
|
|
254
269
|
return None
|
|
@@ -323,16 +338,15 @@ class Fpath:
|
|
|
323
338
|
cls.paths.append(cls(path))
|
|
324
339
|
|
|
325
340
|
@classmethod
|
|
326
|
-
def add(cls, name: str,
|
|
341
|
+
def add(cls, name: str, depth: int) -> None:
|
|
327
342
|
'Add file[s]/dir[s] to the list of paths'
|
|
328
343
|
path = Path(name)
|
|
329
344
|
if not path.exists():
|
|
330
345
|
sys.exit(f'ERROR: {name} does not exist')
|
|
331
346
|
|
|
332
|
-
if
|
|
333
|
-
for child in
|
|
334
|
-
|
|
335
|
-
cls.append(child)
|
|
347
|
+
if path.is_dir():
|
|
348
|
+
for child in find_in_dir(path, depth, args.all):
|
|
349
|
+
cls.append(child)
|
|
336
350
|
else:
|
|
337
351
|
cls.append(path)
|
|
338
352
|
|
|
@@ -390,7 +404,7 @@ class Fpath:
|
|
|
390
404
|
path.newpath = newpath
|
|
391
405
|
|
|
392
406
|
@classmethod
|
|
393
|
-
def get_path_changes(cls) ->
|
|
407
|
+
def get_path_changes(cls) -> list:
|
|
394
408
|
'Get a list of change paths from the user'
|
|
395
409
|
prompt = create_prompt('proceed/yes edit restart quit[default]') \
|
|
396
410
|
if args.interactive else None
|
|
@@ -451,7 +465,7 @@ def main() -> int:
|
|
|
451
465
|
'Main code'
|
|
452
466
|
global args
|
|
453
467
|
# Process command line options
|
|
454
|
-
opt = argparse.ArgumentParser(description=__doc__
|
|
468
|
+
opt = argparse.ArgumentParser(description=__doc__,
|
|
455
469
|
epilog='Note you can set default starting options in '
|
|
456
470
|
f'{CNFFILE}. The negation options (i.e. the --no-* options '
|
|
457
471
|
'and their shortforms) allow you to temporarily override your '
|
|
@@ -491,8 +505,8 @@ def main() -> int:
|
|
|
491
505
|
help='do not color rename/remove/copy messages')
|
|
492
506
|
opt.add_argument('-C', '--no-invert-color', action='store_true',
|
|
493
507
|
help='do not invert the color to highlight error messages')
|
|
494
|
-
opt.add_argument('-d', '--
|
|
495
|
-
help='edit
|
|
508
|
+
opt.add_argument('-d', '--depth', type=int, default=1,
|
|
509
|
+
help='edit paths to specified depth, default=%(default)d')
|
|
496
510
|
grp = opt.add_mutually_exclusive_group()
|
|
497
511
|
grp.add_argument('-F', '--files', action='store_true',
|
|
498
512
|
help='only show/edit files')
|
|
@@ -577,11 +591,9 @@ def main() -> int:
|
|
|
577
591
|
for name in OrderedDict.fromkeys(filelist):
|
|
578
592
|
if name == '-':
|
|
579
593
|
for line in sys.stdin:
|
|
580
|
-
|
|
581
|
-
if name != '.':
|
|
582
|
-
Fpath.add(line.rstrip('\n\r'), False)
|
|
594
|
+
Fpath.add(line.rstrip('\n\r'), 0)
|
|
583
595
|
else:
|
|
584
|
-
Fpath.add(name,
|
|
596
|
+
Fpath.add(name, args.depth)
|
|
585
597
|
|
|
586
598
|
# Sanity check that we have something to edit
|
|
587
599
|
if not Fpath.paths:
|
|
@@ -598,8 +610,8 @@ def main() -> int:
|
|
|
598
610
|
Fpath.paths.sort(key=Fpath.sort_size, reverse=args.sort_reverse)
|
|
599
611
|
|
|
600
612
|
if args.group_dirs is not None and args.group_dirs >= 0:
|
|
601
|
-
ldirs:
|
|
602
|
-
lfiles:
|
|
613
|
+
ldirs: list[Fpath] = []
|
|
614
|
+
lfiles: list[Fpath] = []
|
|
603
615
|
for path in Fpath.paths:
|
|
604
616
|
(ldirs if path.is_dir else lfiles).append(path)
|
|
605
617
|
Fpath.paths = ldirs + lfiles if args.group_dirs else lfiles + ldirs
|
|
@@ -608,7 +620,7 @@ def main() -> int:
|
|
|
608
620
|
if not paths:
|
|
609
621
|
return 0
|
|
610
622
|
|
|
611
|
-
err:
|
|
623
|
+
err: str | None
|
|
612
624
|
|
|
613
625
|
# Pass 1: Rename all moved files & dirs to temps, delete all removed
|
|
614
626
|
# files.
|
{edir-2.29 → edir-2.30}/.flake8
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|