edir 2.26__tar.gz → 2.28__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.26 → edir-2.28}/Makefile +1 -1
- {edir-2.26/edir.egg-info → edir-2.28}/PKG-INFO +13 -12
- {edir-2.26 → edir-2.28}/README.md +12 -11
- {edir-2.26 → edir-2.28/edir.egg-info}/PKG-INFO +13 -12
- {edir-2.26 → edir-2.28}/edir.py +29 -15
- {edir-2.26 → edir-2.28}/.flake8 +0 -0
- {edir-2.26 → edir-2.28}/.gitignore +0 -0
- {edir-2.26 → edir-2.28}/edir.egg-info/SOURCES.txt +0 -0
- {edir-2.26 → edir-2.28}/edir.egg-info/dependency_links.txt +0 -0
- {edir-2.26 → edir-2.28}/edir.egg-info/entry_points.txt +0 -0
- {edir-2.26 → edir-2.28}/edir.egg-info/requires.txt +0 -0
- {edir-2.26 → edir-2.28}/edir.egg-info/top_level.txt +0 -0
- {edir-2.26 → edir-2.28}/pyproject.toml +0 -0
- {edir-2.26 → edir-2.28}/setup.cfg +0 -0
{edir-2.26 → edir-2.28}/Makefile
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: edir
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.28
|
|
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
|
|
@@ -259,10 +259,11 @@ you can use `-T` on the command line to turn that default option off
|
|
|
259
259
|
temporarily.
|
|
260
260
|
|
|
261
261
|
You can specify an alternative trash program, e.g.
|
|
262
|
-
[`trash-d`](https://github.com/rushsteve1/trash-d) or
|
|
263
|
-
trash`](https://man.archlinux.org/man/gio.1#COMMANDS),
|
|
264
|
-
|
|
265
|
-
option
|
|
262
|
+
[`trash-d`](https://github.com/rushsteve1/trash-d), or
|
|
263
|
+
[`gio trash`](https://man.archlinux.org/man/gio.1#COMMANDS), or
|
|
264
|
+
[`gtrash put`](https://github.com/umlx5h/gtrash),
|
|
265
|
+
by setting the `--trash-program` option. Most likely you
|
|
266
|
+
want to set this as a [default option](#command-default-options).
|
|
266
267
|
|
|
267
268
|
## Previewing Changes
|
|
268
269
|
|
|
@@ -277,16 +278,16 @@ option](#command-default-options) so you are always prompted.
|
|
|
277
278
|
After a preview of pending changes is shown a prompt is presented for
|
|
278
279
|
the user to enter a single key:
|
|
279
280
|
|
|
280
|
-
`(P)roceed, (E)dit, (R)estart, (Q)uit[default]: [p
|
|
281
|
+
`(P)roceed/(Y)es, (E)dit, (R)estart, (Q)uit[default]: [p|y|e|r|q]?`
|
|
281
282
|
|
|
282
283
|
where:
|
|
283
284
|
|
|
284
|
-
|Option
|
|
285
|
-
|---
|
|
286
|
-
|`Proceed`|`p`|Proceed with the path changes
|
|
287
|
-
|`Edit`
|
|
288
|
-
|`Restart
|
|
289
|
-
|`Quit`
|
|
285
|
+
|Option |Key |Action|
|
|
286
|
+
|--- |--- |---|
|
|
287
|
+
|`Proceed/Yes`|`p` or `y`|Proceed with the path changes.|
|
|
288
|
+
|`Edit` |`e` |Edit the path list again, as it is was last edited.|
|
|
289
|
+
|`Restart` |`r` |Restart editing the path list again, as it originally began.|
|
|
290
|
+
|`Quit` |`q` |Quit immediately without making any changes. This is the default if no key is entered.|
|
|
290
291
|
|
|
291
292
|
## Installation or Upgrade
|
|
292
293
|
|
|
@@ -245,10 +245,11 @@ you can use `-T` on the command line to turn that default option off
|
|
|
245
245
|
temporarily.
|
|
246
246
|
|
|
247
247
|
You can specify an alternative trash program, e.g.
|
|
248
|
-
[`trash-d`](https://github.com/rushsteve1/trash-d) or
|
|
249
|
-
trash`](https://man.archlinux.org/man/gio.1#COMMANDS),
|
|
250
|
-
|
|
251
|
-
option
|
|
248
|
+
[`trash-d`](https://github.com/rushsteve1/trash-d), or
|
|
249
|
+
[`gio trash`](https://man.archlinux.org/man/gio.1#COMMANDS), or
|
|
250
|
+
[`gtrash put`](https://github.com/umlx5h/gtrash),
|
|
251
|
+
by setting the `--trash-program` option. Most likely you
|
|
252
|
+
want to set this as a [default option](#command-default-options).
|
|
252
253
|
|
|
253
254
|
## Previewing Changes
|
|
254
255
|
|
|
@@ -263,16 +264,16 @@ option](#command-default-options) so you are always prompted.
|
|
|
263
264
|
After a preview of pending changes is shown a prompt is presented for
|
|
264
265
|
the user to enter a single key:
|
|
265
266
|
|
|
266
|
-
`(P)roceed, (E)dit, (R)estart, (Q)uit[default]: [p
|
|
267
|
+
`(P)roceed/(Y)es, (E)dit, (R)estart, (Q)uit[default]: [p|y|e|r|q]?`
|
|
267
268
|
|
|
268
269
|
where:
|
|
269
270
|
|
|
270
|
-
|Option
|
|
271
|
-
|---
|
|
272
|
-
|`Proceed`|`p`|Proceed with the path changes
|
|
273
|
-
|`Edit`
|
|
274
|
-
|`Restart
|
|
275
|
-
|`Quit`
|
|
271
|
+
|Option |Key |Action|
|
|
272
|
+
|--- |--- |---|
|
|
273
|
+
|`Proceed/Yes`|`p` or `y`|Proceed with the path changes.|
|
|
274
|
+
|`Edit` |`e` |Edit the path list again, as it is was last edited.|
|
|
275
|
+
|`Restart` |`r` |Restart editing the path list again, as it originally began.|
|
|
276
|
+
|`Quit` |`q` |Quit immediately without making any changes. This is the default if no key is entered.|
|
|
276
277
|
|
|
277
278
|
## Installation or Upgrade
|
|
278
279
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: edir
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.28
|
|
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
|
|
@@ -259,10 +259,11 @@ you can use `-T` on the command line to turn that default option off
|
|
|
259
259
|
temporarily.
|
|
260
260
|
|
|
261
261
|
You can specify an alternative trash program, e.g.
|
|
262
|
-
[`trash-d`](https://github.com/rushsteve1/trash-d) or
|
|
263
|
-
trash`](https://man.archlinux.org/man/gio.1#COMMANDS),
|
|
264
|
-
|
|
265
|
-
option
|
|
262
|
+
[`trash-d`](https://github.com/rushsteve1/trash-d), or
|
|
263
|
+
[`gio trash`](https://man.archlinux.org/man/gio.1#COMMANDS), or
|
|
264
|
+
[`gtrash put`](https://github.com/umlx5h/gtrash),
|
|
265
|
+
by setting the `--trash-program` option. Most likely you
|
|
266
|
+
want to set this as a [default option](#command-default-options).
|
|
266
267
|
|
|
267
268
|
## Previewing Changes
|
|
268
269
|
|
|
@@ -277,16 +278,16 @@ option](#command-default-options) so you are always prompted.
|
|
|
277
278
|
After a preview of pending changes is shown a prompt is presented for
|
|
278
279
|
the user to enter a single key:
|
|
279
280
|
|
|
280
|
-
`(P)roceed, (E)dit, (R)estart, (Q)uit[default]: [p
|
|
281
|
+
`(P)roceed/(Y)es, (E)dit, (R)estart, (Q)uit[default]: [p|y|e|r|q]?`
|
|
281
282
|
|
|
282
283
|
where:
|
|
283
284
|
|
|
284
|
-
|Option
|
|
285
|
-
|---
|
|
286
|
-
|`Proceed`|`p`|Proceed with the path changes
|
|
287
|
-
|`Edit`
|
|
288
|
-
|`Restart
|
|
289
|
-
|`Quit`
|
|
285
|
+
|Option |Key |Action|
|
|
286
|
+
|--- |--- |---|
|
|
287
|
+
|`Proceed/Yes`|`p` or `y`|Proceed with the path changes.|
|
|
288
|
+
|`Edit` |`e` |Edit the path list again, as it is was last edited.|
|
|
289
|
+
|`Restart` |`r` |Restart editing the path list again, as it originally began.|
|
|
290
|
+
|`Quit` |`q` |Quit immediately without making any changes. This is the default if no key is entered.|
|
|
290
291
|
|
|
291
292
|
## Installation or Upgrade
|
|
292
293
|
|
{edir-2.26 → edir-2.28}/edir.py
RENAMED
|
@@ -127,7 +127,7 @@ def remove(path: Path, git: bool = False, trash: bool = False,
|
|
|
127
127
|
out, err = run(f'{args.trash_program} "{path}"')
|
|
128
128
|
return f'{args.trash_program} error: {err}' if err else None
|
|
129
129
|
|
|
130
|
-
if recurse:
|
|
130
|
+
if recurse and not path.is_symlink():
|
|
131
131
|
try:
|
|
132
132
|
shutil.rmtree(str(path))
|
|
133
133
|
except Exception as e:
|
|
@@ -164,9 +164,12 @@ def create_prompt(options: str) -> str:
|
|
|
164
164
|
letters = []
|
|
165
165
|
words = []
|
|
166
166
|
for arg in options.split():
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
subwords = []
|
|
168
|
+
for subarg in arg.split('/'):
|
|
169
|
+
letters.append(subarg[0])
|
|
170
|
+
subwords.append(f'({subarg[0].upper()}){subarg[1:]}')
|
|
171
|
+
words.append('/'.join(subwords))
|
|
172
|
+
return ', '.join(words) + ': [' + '|'.join(letters) + ']? '
|
|
170
173
|
|
|
171
174
|
class Fpath:
|
|
172
175
|
'Class to manage each instance of a file/dir'
|
|
@@ -181,7 +184,7 @@ class Fpath:
|
|
|
181
184
|
self.note = ''
|
|
182
185
|
self.copies: List[Path] = []
|
|
183
186
|
try:
|
|
184
|
-
self.is_dir = path.is_dir()
|
|
187
|
+
self.is_dir = path.is_dir() and not path.is_symlink()
|
|
185
188
|
except Exception as e:
|
|
186
189
|
sys.exit(f'ERROR: Can not read {path}: {e}')
|
|
187
190
|
|
|
@@ -249,11 +252,21 @@ class Fpath:
|
|
|
249
252
|
|
|
250
253
|
def sort_time(self) -> float:
|
|
251
254
|
'Return time for sort'
|
|
252
|
-
|
|
255
|
+
try:
|
|
256
|
+
ret = self.path.lstat().st_mtime
|
|
257
|
+
except Exception:
|
|
258
|
+
ret = 0
|
|
259
|
+
|
|
260
|
+
return ret
|
|
253
261
|
|
|
254
262
|
def sort_size(self) -> int:
|
|
255
263
|
'Return size for sort'
|
|
256
|
-
|
|
264
|
+
try:
|
|
265
|
+
ret = self.path.lstat().st_size
|
|
266
|
+
except Exception:
|
|
267
|
+
ret = 0
|
|
268
|
+
|
|
269
|
+
return ret
|
|
257
270
|
|
|
258
271
|
def is_recursive(self) -> bool:
|
|
259
272
|
'Return True if directory and we can view it and contains children'
|
|
@@ -370,7 +383,9 @@ class Fpath:
|
|
|
370
383
|
@classmethod
|
|
371
384
|
def get_path_changes(cls) -> List:
|
|
372
385
|
'Get a list of change paths from the user'
|
|
373
|
-
|
|
386
|
+
prompt = create_prompt('proceed/yes edit restart quit[default]') \
|
|
387
|
+
if args.interactive else None
|
|
388
|
+
|
|
374
389
|
with tempfile.TemporaryDirectory() as fdir:
|
|
375
390
|
# Create a temp file for the user to edit then read the lines back
|
|
376
391
|
fpath = Path(fdir, f'{PROG}{args.suffix}')
|
|
@@ -397,7 +412,7 @@ class Fpath:
|
|
|
397
412
|
for p in paths:
|
|
398
413
|
p.note = ' recursively' if p.is_recursive() else ''
|
|
399
414
|
|
|
400
|
-
if not
|
|
415
|
+
if not prompt:
|
|
401
416
|
return paths
|
|
402
417
|
|
|
403
418
|
# Prompt user with pending changes if required
|
|
@@ -406,27 +421,26 @@ class Fpath:
|
|
|
406
421
|
|
|
407
422
|
while True:
|
|
408
423
|
try:
|
|
409
|
-
ans = input(
|
|
424
|
+
ans = input(prompt).strip().lower()
|
|
410
425
|
except KeyboardInterrupt:
|
|
411
426
|
print()
|
|
412
427
|
return []
|
|
413
428
|
|
|
414
|
-
if ans == '
|
|
429
|
+
if not ans or ans == 'q':
|
|
430
|
+
return []
|
|
431
|
+
elif ans in 'py':
|
|
415
432
|
return paths
|
|
416
433
|
elif ans == 'e':
|
|
417
434
|
break
|
|
418
435
|
elif ans == 'r':
|
|
419
436
|
restart = True
|
|
420
437
|
break
|
|
421
|
-
elif not ans or ans == 'q':
|
|
422
|
-
return []
|
|
423
438
|
else:
|
|
424
|
-
print('Invalid answer.')
|
|
439
|
+
print(f'Invalid answer "{ans}".')
|
|
425
440
|
|
|
426
441
|
def main() -> int:
|
|
427
442
|
'Main code'
|
|
428
443
|
global args
|
|
429
|
-
|
|
430
444
|
# Process command line options
|
|
431
445
|
opt = argparse.ArgumentParser(description=__doc__.strip(),
|
|
432
446
|
epilog='Note you can set default starting options in '
|
{edir-2.26 → edir-2.28}/.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
|