edir 2.38__tar.gz → 2.40__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.38 → edir-2.40}/PKG-INFO +4 -6
- {edir-2.38 → edir-2.40}/README.md +3 -4
- {edir-2.38 → edir-2.40}/edir.egg-info/PKG-INFO +4 -6
- {edir-2.38 → edir-2.40}/edir.egg-info/scm_file_list.json +4 -4
- edir-2.40/edir.egg-info/scm_version.json +8 -0
- {edir-2.38 → edir-2.40}/edir.py +31 -26
- {edir-2.38 → edir-2.40}/justfile +1 -1
- {edir-2.38 → edir-2.40}/pyproject.toml +2 -16
- edir-2.38/edir.egg-info/scm_version.json +0 -8
- {edir-2.38 → edir-2.40}/.gitignore +0 -0
- {edir-2.38 → edir-2.40}/edir.egg-info/SOURCES.txt +0 -0
- {edir-2.38 → edir-2.40}/edir.egg-info/dependency_links.txt +0 -0
- {edir-2.38 → edir-2.40}/edir.egg-info/entry_points.txt +0 -0
- {edir-2.38 → edir-2.40}/edir.egg-info/requires.txt +0 -0
- {edir-2.38 → edir-2.40}/edir.egg-info/top_level.txt +0 -0
- {edir-2.38 → edir-2.40}/setup.cfg +0 -0
{edir-2.38 → edir-2.40}/PKG-INFO
RENAMED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: edir
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.40
|
|
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
|
|
7
7
|
Project-URL: Homepage, https://github.com/bulletmark/edir
|
|
8
8
|
Keywords: vidir,git,trash,trash-put,thrash-d
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
9
|
Requires-Python: >=3.8
|
|
11
10
|
Description-Content-Type: text/markdown
|
|
12
11
|
Requires-Dist: argparse-from-file
|
|
@@ -210,7 +209,7 @@ following ways:
|
|
|
210
209
|
list:
|
|
211
210
|
|
|
212
211
|
1. Must start with a number and that number must be in range.
|
|
213
|
-
2. Must have at least one white space/tab after the number,
|
|
212
|
+
2. Must have at least one white space and/or tab after the number,
|
|
214
213
|
3. Must have a remaining valid path name.
|
|
215
214
|
4. Can start with a `#` or be completely blank to be considered the
|
|
216
215
|
same as deleted.
|
|
@@ -346,8 +345,7 @@ You can add default options to a personal configuration file
|
|
|
346
345
|
`~/.config/edir-flags.conf`. If that file exists then each line of
|
|
347
346
|
options will be concatenated and automatically prepended to your `edir`
|
|
348
347
|
command line arguments. Comments in the file (i.e. starting with a `#`)
|
|
349
|
-
are ignored. Type `edir -h` to see all [supported
|
|
350
|
-
options](#command-line-options).
|
|
348
|
+
are ignored. Type `edir -h` to see all [supported options](#usage).
|
|
351
349
|
|
|
352
350
|
Some options, e.g. `--recurse`, which can be set as a default option, provide
|
|
353
351
|
another "on-the-fly" negation option to temporarily override and disable the
|
|
@@ -387,7 +385,7 @@ repository files only, in the current directory only:
|
|
|
387
385
|
$ fd -d1 -tf | edir -g
|
|
388
386
|
```
|
|
389
387
|
|
|
390
|
-
##
|
|
388
|
+
## Usage
|
|
391
389
|
|
|
392
390
|
Type `edir -h` to view the usage summary:
|
|
393
391
|
|
|
@@ -196,7 +196,7 @@ following ways:
|
|
|
196
196
|
list:
|
|
197
197
|
|
|
198
198
|
1. Must start with a number and that number must be in range.
|
|
199
|
-
2. Must have at least one white space/tab after the number,
|
|
199
|
+
2. Must have at least one white space and/or tab after the number,
|
|
200
200
|
3. Must have a remaining valid path name.
|
|
201
201
|
4. Can start with a `#` or be completely blank to be considered the
|
|
202
202
|
same as deleted.
|
|
@@ -332,8 +332,7 @@ You can add default options to a personal configuration file
|
|
|
332
332
|
`~/.config/edir-flags.conf`. If that file exists then each line of
|
|
333
333
|
options will be concatenated and automatically prepended to your `edir`
|
|
334
334
|
command line arguments. Comments in the file (i.e. starting with a `#`)
|
|
335
|
-
are ignored. Type `edir -h` to see all [supported
|
|
336
|
-
options](#command-line-options).
|
|
335
|
+
are ignored. Type `edir -h` to see all [supported options](#usage).
|
|
337
336
|
|
|
338
337
|
Some options, e.g. `--recurse`, which can be set as a default option, provide
|
|
339
338
|
another "on-the-fly" negation option to temporarily override and disable the
|
|
@@ -373,7 +372,7 @@ repository files only, in the current directory only:
|
|
|
373
372
|
$ fd -d1 -tf | edir -g
|
|
374
373
|
```
|
|
375
374
|
|
|
376
|
-
##
|
|
375
|
+
## Usage
|
|
377
376
|
|
|
378
377
|
Type `edir -h` to view the usage summary:
|
|
379
378
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: edir
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.40
|
|
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
|
|
7
7
|
Project-URL: Homepage, https://github.com/bulletmark/edir
|
|
8
8
|
Keywords: vidir,git,trash,trash-put,thrash-d
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
9
|
Requires-Python: >=3.8
|
|
11
10
|
Description-Content-Type: text/markdown
|
|
12
11
|
Requires-Dist: argparse-from-file
|
|
@@ -210,7 +209,7 @@ following ways:
|
|
|
210
209
|
list:
|
|
211
210
|
|
|
212
211
|
1. Must start with a number and that number must be in range.
|
|
213
|
-
2. Must have at least one white space/tab after the number,
|
|
212
|
+
2. Must have at least one white space and/or tab after the number,
|
|
214
213
|
3. Must have a remaining valid path name.
|
|
215
214
|
4. Can start with a `#` or be completely blank to be considered the
|
|
216
215
|
same as deleted.
|
|
@@ -346,8 +345,7 @@ You can add default options to a personal configuration file
|
|
|
346
345
|
`~/.config/edir-flags.conf`. If that file exists then each line of
|
|
347
346
|
options will be concatenated and automatically prepended to your `edir`
|
|
348
347
|
command line arguments. Comments in the file (i.e. starting with a `#`)
|
|
349
|
-
are ignored. Type `edir -h` to see all [supported
|
|
350
|
-
options](#command-line-options).
|
|
348
|
+
are ignored. Type `edir -h` to see all [supported options](#usage).
|
|
351
349
|
|
|
352
350
|
Some options, e.g. `--recurse`, which can be set as a default option, provide
|
|
353
351
|
another "on-the-fly" negation option to temporarily override and disable the
|
|
@@ -387,7 +385,7 @@ repository files only, in the current directory only:
|
|
|
387
385
|
$ fd -d1 -tf | edir -g
|
|
388
386
|
```
|
|
389
387
|
|
|
390
|
-
##
|
|
388
|
+
## Usage
|
|
391
389
|
|
|
392
390
|
Type `edir -h` to view the usage summary:
|
|
393
391
|
|
{edir-2.38 → edir-2.40}/edir.py
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
1
|
"""
|
|
3
2
|
Command line utility to rename, remove, or copy files and directories directly
|
|
4
3
|
from your editor. When run, you'll see a numbered list of files in your editor.
|
|
@@ -10,17 +9,19 @@ repository, git will be used for renames and removals.
|
|
|
10
9
|
# Author: Mark Blakeney, May 2019.
|
|
11
10
|
from __future__ import annotations
|
|
12
11
|
|
|
13
|
-
import
|
|
12
|
+
import sys
|
|
13
|
+
|
|
14
|
+
if sys.version_info >= (3, 15):
|
|
15
|
+
sys.set_lazy_imports('all')
|
|
16
|
+
|
|
14
17
|
import os
|
|
15
|
-
import re
|
|
16
18
|
import shlex
|
|
17
19
|
import shutil
|
|
18
20
|
import subprocess
|
|
19
|
-
import sys
|
|
20
|
-
import tempfile
|
|
21
21
|
from collections.abc import Callable, Iterable, Sequence
|
|
22
|
+
from os.path import lexists
|
|
22
23
|
from pathlib import Path
|
|
23
|
-
from typing import NoReturn
|
|
24
|
+
from typing import ClassVar, NoReturn
|
|
24
25
|
|
|
25
26
|
import argparse_from_file as argparse
|
|
26
27
|
|
|
@@ -144,9 +145,7 @@ def run(cmd: Sequence[str]) -> tuple[str, str]:
|
|
|
144
145
|
stdout = ''
|
|
145
146
|
stderr = ''
|
|
146
147
|
try:
|
|
147
|
-
res = subprocess.run(
|
|
148
|
-
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True
|
|
149
|
-
)
|
|
148
|
+
res = subprocess.run(cmd, capture_output=True, text=True)
|
|
150
149
|
except Exception as e:
|
|
151
150
|
stderr = str(e)
|
|
152
151
|
else:
|
|
@@ -253,6 +252,7 @@ class CopyNameTemplate:
|
|
|
253
252
|
|
|
254
253
|
def __init__(self, template: str) -> None:
|
|
255
254
|
"Create a template for copy file/path names from given name"
|
|
255
|
+
import re
|
|
256
256
|
|
|
257
257
|
def _exit(msg: str) -> NoReturn:
|
|
258
258
|
sys.exit(f'ERROR: --copy-name-template "{template}" {msg}')
|
|
@@ -285,8 +285,8 @@ class CopyNameTemplate:
|
|
|
285
285
|
class Fpath:
|
|
286
286
|
"Class to manage each instance of a file/dir"
|
|
287
287
|
|
|
288
|
-
paths = []
|
|
289
|
-
tempdirs = set()
|
|
288
|
+
paths: ClassVar = []
|
|
289
|
+
tempdirs: ClassVar = set()
|
|
290
290
|
natsort_key: Callable
|
|
291
291
|
|
|
292
292
|
def __init__(self, path: Path) -> None:
|
|
@@ -314,6 +314,8 @@ class Fpath:
|
|
|
314
314
|
@staticmethod
|
|
315
315
|
def inc_path(path: Path, check_list: list[Path] | None = None) -> Path:
|
|
316
316
|
"Find next unique file name"
|
|
317
|
+
import itertools
|
|
318
|
+
|
|
317
319
|
# Iterate forever, there can only be a finite number of existing
|
|
318
320
|
# paths
|
|
319
321
|
if check_list is None:
|
|
@@ -321,7 +323,7 @@ class Fpath:
|
|
|
321
323
|
|
|
322
324
|
name = path.name
|
|
323
325
|
for c in itertools.count():
|
|
324
|
-
if not
|
|
326
|
+
if not lexists(path) and path not in check_list:
|
|
325
327
|
break
|
|
326
328
|
|
|
327
329
|
path = path.with_name(args._copy_name(name, c))
|
|
@@ -445,7 +447,7 @@ class Fpath:
|
|
|
445
447
|
try:
|
|
446
448
|
nsval = getattr(ns, opt)
|
|
447
449
|
except AttributeError as e:
|
|
448
|
-
sys.exit(f'ERROR: invalid natsort option: {
|
|
450
|
+
sys.exit(f'ERROR: invalid natsort option: {e}')
|
|
449
451
|
|
|
450
452
|
if nsval and isinstance(nsval, int):
|
|
451
453
|
optval |= nsval
|
|
@@ -469,9 +471,8 @@ class Fpath:
|
|
|
469
471
|
if args.files:
|
|
470
472
|
if path.is_dir():
|
|
471
473
|
return
|
|
472
|
-
elif args.dirs:
|
|
473
|
-
|
|
474
|
-
return
|
|
474
|
+
elif args.dirs and not path.is_dir():
|
|
475
|
+
return
|
|
475
476
|
|
|
476
477
|
# Filter out links if asked
|
|
477
478
|
if args.nolinks and path.is_symlink():
|
|
@@ -484,7 +485,7 @@ class Fpath:
|
|
|
484
485
|
"Add file[s]/dir[s] to the list of paths"
|
|
485
486
|
path = Path(name)
|
|
486
487
|
|
|
487
|
-
if not path
|
|
488
|
+
if not lexists(path):
|
|
488
489
|
sys.exit(f'ERROR: {name} does not exist')
|
|
489
490
|
|
|
490
491
|
if not args.no_relative:
|
|
@@ -507,7 +508,7 @@ class Fpath:
|
|
|
507
508
|
# Ensure consistent width for line numbers
|
|
508
509
|
num_width = len(str(len(cls.paths)))
|
|
509
510
|
fp.writelines(
|
|
510
|
-
f'{i:0{num_width}}
|
|
511
|
+
f'{i:0{num_width}}\t{p.linerepr}\n' for i, p in enumerate(cls.paths, 1)
|
|
511
512
|
)
|
|
512
513
|
|
|
513
514
|
@classmethod
|
|
@@ -556,6 +557,8 @@ class Fpath:
|
|
|
556
557
|
@classmethod
|
|
557
558
|
def get_path_changes(cls) -> list:
|
|
558
559
|
"Get a list of change paths from the user"
|
|
560
|
+
import tempfile
|
|
561
|
+
|
|
559
562
|
prompt = (
|
|
560
563
|
create_prompt('proceed/yes edit restart quit[default]')
|
|
561
564
|
if args.interactive
|
|
@@ -929,20 +932,22 @@ def main() -> int:
|
|
|
929
932
|
# files.
|
|
930
933
|
for p in paths:
|
|
931
934
|
if p.newpath:
|
|
932
|
-
if p.changed():
|
|
933
|
-
|
|
934
|
-
log('rename', f'"{p.diagrepr}" to "{p.newpath}{p.appdash}"', err)
|
|
935
|
+
if p.changed() and (err := p.rename_temp()):
|
|
936
|
+
log('rename', f'"{p.diagrepr}" to "{p.newpath}{p.appdash}"', err)
|
|
935
937
|
elif not p.is_dir:
|
|
936
938
|
err = remove(p.path, p.is_git, args.trash)
|
|
937
939
|
log('remove', f'"{p.diagrepr}"', err)
|
|
938
940
|
|
|
939
941
|
# Pass 2: Delete all removed dirs, if empty or recursive delete.
|
|
940
942
|
for p in paths:
|
|
941
|
-
if
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
943
|
+
if (
|
|
944
|
+
p.is_dir
|
|
945
|
+
and not p.newpath
|
|
946
|
+
and remove(p.path, p.is_git, args.trash, args.recurse) is None
|
|
947
|
+
):
|
|
948
|
+
# Have removed, so flag as finished for final dirs pass below
|
|
949
|
+
p.is_dir = False
|
|
950
|
+
log('remove', f'"{p.diagrepr}"{p.note}')
|
|
946
951
|
|
|
947
952
|
# Pass 3. Rename all temp files and dirs to final target, and make
|
|
948
953
|
# copies.
|
{edir-2.38 → edir-2.40}/justfile
RENAMED
|
@@ -9,9 +9,6 @@ readme = "README.md"
|
|
|
9
9
|
license = "GPL-3.0-or-later"
|
|
10
10
|
requires-python = ">=3.8"
|
|
11
11
|
keywords = ["vidir", "git", "trash", "trash-put", "thrash-d"]
|
|
12
|
-
classifiers = [
|
|
13
|
-
"Programming Language :: Python :: 3",
|
|
14
|
-
]
|
|
15
12
|
dynamic = ["version"]
|
|
16
13
|
dependencies = [
|
|
17
14
|
"argparse-from-file",
|
|
@@ -31,21 +28,10 @@ edir = "edir:main"
|
|
|
31
28
|
[tool.setuptools_scm]
|
|
32
29
|
version_scheme = "post-release"
|
|
33
30
|
|
|
34
|
-
[tool.mypy]
|
|
35
|
-
implicit_optional = true
|
|
36
|
-
warn_no_return = false
|
|
37
|
-
allow_untyped_globals = true
|
|
38
|
-
allow_redefinition = true
|
|
39
|
-
|
|
40
31
|
[tool.ruff.format]
|
|
41
32
|
quote-style = "single"
|
|
42
|
-
skip-magic-trailing-comma = true
|
|
43
33
|
|
|
44
|
-
[tool.
|
|
45
|
-
|
|
46
|
-
"ruff check",
|
|
47
|
-
"mypy",
|
|
48
|
-
"pyright",
|
|
49
|
-
]
|
|
34
|
+
[tool.ruff.lint]
|
|
35
|
+
ignore = ["SIM115", "SIM905", "BLE001", "PLW1510"]
|
|
50
36
|
|
|
51
37
|
# vim:se sw=2:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|