flyshell 1.0.9__tar.gz → 1.0.10__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.9/src/flyshell.egg-info → flyshell-1.0.10}/PKG-INFO +1 -1
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/builtin/diskops.py +59 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/constants.py +2 -2
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/core/directory.py +1 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/main.py +1 -1
- {flyshell-1.0.9 → flyshell-1.0.10/src/flyshell.egg-info}/PKG-INFO +1 -1
- {flyshell-1.0.9 → flyshell-1.0.10}/LICENSE +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/README.md +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/pyproject.toml +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/setup.cfg +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/__init__.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/abstract/__init__.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/abstract/base_cmd.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/abstract/base_plugin.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/abstract/parent_cmd.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/builtin/__init__.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/builtin/fs.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/builtin/system.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/builtin/utils.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/core/__init__.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/core/auth.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/core/console.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/core/data.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell/core/loader.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell.egg-info/SOURCES.txt +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell.egg-info/dependency_links.txt +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell.egg-info/entry_points.txt +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell.egg-info/requires.txt +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/src/flyshell.egg-info/top_level.txt +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/tests/test_auth.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/tests/test_data.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/tests/test_directory.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/tests/test_loader.py +0 -0
- {flyshell-1.0.9 → flyshell-1.0.10}/tests/test_security.py +0 -0
|
@@ -8,6 +8,65 @@ import os
|
|
|
8
8
|
import shutil
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
class Cat(BaseCmd):
|
|
12
|
+
name = "cat"
|
|
13
|
+
description = "Display the contents of a text file"
|
|
14
|
+
min_args = 1
|
|
15
|
+
options = "Target file"
|
|
16
|
+
aliases = ["read"]
|
|
17
|
+
|
|
18
|
+
def execute(self, args):
|
|
19
|
+
show_numbers = ("-n" in args) or ("--number" in args)
|
|
20
|
+
limit = None
|
|
21
|
+
filtered_args = []
|
|
22
|
+
skip_next = False
|
|
23
|
+
for i, token in enumerate(args):
|
|
24
|
+
if skip_next:
|
|
25
|
+
skip_next = False
|
|
26
|
+
continue
|
|
27
|
+
if token in ("-n", "--number"):
|
|
28
|
+
continue
|
|
29
|
+
if token in ("-l", "--limit"):
|
|
30
|
+
if i + 1 < len(args) and args[i + 1].isdigit():
|
|
31
|
+
limit = int(args[i + 1])
|
|
32
|
+
skip_next = True
|
|
33
|
+
continue
|
|
34
|
+
else:
|
|
35
|
+
return (1, f"\nCommand Error: '{token}' requires a positive integer limit.\n")
|
|
36
|
+
filtered_args.append(token)
|
|
37
|
+
if not filtered_args:
|
|
38
|
+
return (1, "\nCommand Error: Target file not specified.\n")
|
|
39
|
+
raw_target = " ".join(filtered_args).strip("\"'")
|
|
40
|
+
target_path = Path(raw_target).expanduser().resolve()
|
|
41
|
+
if not target_path.exists():
|
|
42
|
+
return (1, f"\nSystem Error: File '{raw_target}' not found.\n")
|
|
43
|
+
if target_path.is_dir():
|
|
44
|
+
return (1, f"\nSystem Error: '{raw_target}' is a directory, not a file.\n")
|
|
45
|
+
try:
|
|
46
|
+
with open(target_path, "r", encoding="utf-8", errors="replace") as f:
|
|
47
|
+
lines = f.readlines()
|
|
48
|
+
total_lines = len(lines)
|
|
49
|
+
if total_lines == 0:
|
|
50
|
+
return (1, f"\nSystem Error: '{raw_target}' is empty.\n")
|
|
51
|
+
if limit is not None:
|
|
52
|
+
lines = lines[:limit]
|
|
53
|
+
output_lines = [
|
|
54
|
+
f"\nDisplaying contents of file '{target_path.name}' ({len(lines)}/{total_lines} lines)\n"
|
|
55
|
+
]
|
|
56
|
+
for line_idx, line in enumerate(lines, start=1):
|
|
57
|
+
clean_line = line.rstrip("\r\n")
|
|
58
|
+
if show_numbers:
|
|
59
|
+
output_lines.append(f"{line_idx:4d} | {clean_line}")
|
|
60
|
+
else:
|
|
61
|
+
output_lines.append(clean_line)
|
|
62
|
+
output_lines.append(f"\nEnd of '{target_path.name}'\n")
|
|
63
|
+
return (0, "\n".join(output_lines))
|
|
64
|
+
except PermissionError:
|
|
65
|
+
return (1, f"\nSystem Error: Permission denied. Cannot read '{raw_target}'\n")
|
|
66
|
+
except Exception as e:
|
|
67
|
+
return (1, f"\nSystem Error: Failed to read file '{raw_target}' ({e})\n")
|
|
68
|
+
|
|
69
|
+
|
|
11
70
|
class Dir(BaseCmd):
|
|
12
71
|
name = "dir"
|
|
13
72
|
description = "List all files in the current working directory"
|
|
@@ -83,7 +83,7 @@ def main():
|
|
|
83
83
|
sys.exit(0)
|
|
84
84
|
else:
|
|
85
85
|
print(
|
|
86
|
-
f"\nCRITICAL ERROR: Host operating system '{
|
|
86
|
+
f"\nCRITICAL ERROR: Host operating system '{c.HOST_OS}' is not supported."
|
|
87
87
|
)
|
|
88
88
|
print(
|
|
89
89
|
"Flyshell cannot launch because your operating system is not supported."
|
|
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
|