flyshell 1.0.12__tar.gz → 1.0.13__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.
- {flyshell-1.0.12/src/flyshell.egg-info → flyshell-1.0.13}/PKG-INFO +1 -1
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/builtin/diskops.py +49 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/builtin/utils.py +16 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/constants.py +2 -2
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/core/directory.py +2 -0
- {flyshell-1.0.12 → flyshell-1.0.13/src/flyshell.egg-info}/PKG-INFO +1 -1
- {flyshell-1.0.12 → flyshell-1.0.13}/LICENSE +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/README.md +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/pyproject.toml +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/setup.cfg +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/__init__.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/abstract/__init__.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/abstract/base_cmd.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/abstract/base_plugin.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/abstract/parent_cmd.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/builtin/__init__.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/builtin/fs.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/builtin/system.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/core/__init__.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/core/auth.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/core/console.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/core/data.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/core/loader.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell/main.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell.egg-info/SOURCES.txt +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell.egg-info/dependency_links.txt +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell.egg-info/entry_points.txt +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell.egg-info/requires.txt +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/src/flyshell.egg-info/top_level.txt +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/tests/test_auth.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/tests/test_data.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/tests/test_directory.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/tests/test_loader.py +0 -0
- {flyshell-1.0.12 → flyshell-1.0.13}/tests/test_security.py +0 -0
|
@@ -259,6 +259,55 @@ class Move(BaseCmd):
|
|
|
259
259
|
return (1, f"\nSystem Error: Failed to move '{raw_src}' ({e})\n")
|
|
260
260
|
|
|
261
261
|
|
|
262
|
+
class Rename(BaseCmd):
|
|
263
|
+
name = "rename"
|
|
264
|
+
description = "Rename a file or directory"
|
|
265
|
+
min_args = 2
|
|
266
|
+
options = "Old name, then new name"
|
|
267
|
+
aliases = []
|
|
268
|
+
|
|
269
|
+
def execute(self, args):
|
|
270
|
+
raw_src = args[0].strip("\"'")
|
|
271
|
+
raw_new_name = args[1].strip("\"'")
|
|
272
|
+
if "/" in raw_new_name or "\\" in raw_new_name:
|
|
273
|
+
return (
|
|
274
|
+
1,
|
|
275
|
+
"\nCommand Error: The new name must not contain path separators ('/' or '\\')\n"
|
|
276
|
+
"Use 'mv' to move items between different folders.\n",
|
|
277
|
+
)
|
|
278
|
+
src_path = Path(raw_src).expanduser().resolve()
|
|
279
|
+
if not src_path.exists():
|
|
280
|
+
return (1, f"\nSystem Error: Target '{raw_src}' not found.\n")
|
|
281
|
+
flyshell_dirs = [
|
|
282
|
+
c.APP_DIR.resolve(),
|
|
283
|
+
c.PACKAGE_ROOT.resolve(),
|
|
284
|
+
c.PROJECT_ROOT.resolve(),
|
|
285
|
+
]
|
|
286
|
+
for protected in flyshell_dirs:
|
|
287
|
+
if src_path == protected or src_path.is_relative_to(protected):
|
|
288
|
+
return (
|
|
289
|
+
1,
|
|
290
|
+
"\nSecurity Error: Flyshell has blocked this action.\n"
|
|
291
|
+
f"Target '{raw_src}' contains or belongs to Flyshell system files.\n",
|
|
292
|
+
)
|
|
293
|
+
new_path = src_path.parent / raw_new_name
|
|
294
|
+
if new_path.exists():
|
|
295
|
+
return (
|
|
296
|
+
1,
|
|
297
|
+
f"\nSystem Error: An item named '{raw_new_name}' already exists in this folder.\n",
|
|
298
|
+
)
|
|
299
|
+
try:
|
|
300
|
+
src_path.rename(new_path)
|
|
301
|
+
return (0, f"\nSUCCESS! Renamed '{src_path.name}' -> '{new_path.name}'\n")
|
|
302
|
+
except PermissionError:
|
|
303
|
+
return (
|
|
304
|
+
1,
|
|
305
|
+
f"\nSystem Error: Permission denied. Cannot rename '{raw_src}'\n",
|
|
306
|
+
)
|
|
307
|
+
except Exception as e:
|
|
308
|
+
return (1, f"\nSystem Error: Failed to rename '{raw_src}' ({e})\n")
|
|
309
|
+
|
|
310
|
+
|
|
262
311
|
class Rm(BaseCmd):
|
|
263
312
|
name = "rm"
|
|
264
313
|
description = "Remove files from the filesystem"
|
|
@@ -22,6 +22,22 @@ class Clear(BaseCmd):
|
|
|
22
22
|
return (0, c.CLEAR_SCREEN)
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
class Echo(BaseCmd):
|
|
26
|
+
name = "echo"
|
|
27
|
+
description = "Print arguments to terminal"
|
|
28
|
+
min_args = 1
|
|
29
|
+
options = "Message"
|
|
30
|
+
aliases = []
|
|
31
|
+
|
|
32
|
+
def execute(self, args):
|
|
33
|
+
text = " ".join(args)
|
|
34
|
+
try:
|
|
35
|
+
text = text.encode("utf-8").decode("unicode_escape")
|
|
36
|
+
except Exception:
|
|
37
|
+
pass
|
|
38
|
+
return (0, f"\n{text}\n")
|
|
39
|
+
|
|
40
|
+
|
|
25
41
|
class History(BaseCmd):
|
|
26
42
|
name = "history"
|
|
27
43
|
description = "View command history"
|
|
@@ -55,6 +55,7 @@ INSTALLED_COMMANDS: list[BaseCmd] = [
|
|
|
55
55
|
utils.Clear(),
|
|
56
56
|
diskops.Copy(),
|
|
57
57
|
diskops.Dir(),
|
|
58
|
+
utils.Echo(),
|
|
58
59
|
fs.Fs(),
|
|
59
60
|
utils.History(),
|
|
60
61
|
utils.Kill(),
|
|
@@ -63,6 +64,7 @@ INSTALLED_COMMANDS: list[BaseCmd] = [
|
|
|
63
64
|
diskops.Move(),
|
|
64
65
|
system.OpenFile(),
|
|
65
66
|
utils.Reboot(),
|
|
67
|
+
diskops.Rename(),
|
|
66
68
|
diskops.Rm(),
|
|
67
69
|
diskops.RmDir(),
|
|
68
70
|
utils.Sleep(),
|
|
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
|
|
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
|
|
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
|
|
File without changes
|