flyshell 1.0.7__tar.gz → 1.0.8__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.
Files changed (35) hide show
  1. {flyshell-1.0.7/src/flyshell.egg-info → flyshell-1.0.8}/PKG-INFO +1 -1
  2. flyshell-1.0.8/src/flyshell/builtin/diskops.py +114 -0
  3. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/constants.py +2 -2
  4. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/core/directory.py +2 -0
  5. {flyshell-1.0.7 → flyshell-1.0.8/src/flyshell.egg-info}/PKG-INFO +1 -1
  6. flyshell-1.0.7/src/flyshell/builtin/diskops.py +0 -28
  7. {flyshell-1.0.7 → flyshell-1.0.8}/LICENSE +0 -0
  8. {flyshell-1.0.7 → flyshell-1.0.8}/README.md +0 -0
  9. {flyshell-1.0.7 → flyshell-1.0.8}/pyproject.toml +0 -0
  10. {flyshell-1.0.7 → flyshell-1.0.8}/setup.cfg +0 -0
  11. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/__init__.py +0 -0
  12. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/abstract/__init__.py +0 -0
  13. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/abstract/base_cmd.py +0 -0
  14. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/abstract/base_plugin.py +0 -0
  15. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/abstract/parent_cmd.py +0 -0
  16. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/builtin/__init__.py +0 -0
  17. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/builtin/fs.py +0 -0
  18. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/builtin/system.py +0 -0
  19. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/builtin/utils.py +0 -0
  20. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/core/__init__.py +0 -0
  21. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/core/auth.py +0 -0
  22. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/core/console.py +0 -0
  23. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/core/data.py +0 -0
  24. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/core/loader.py +0 -0
  25. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell/main.py +0 -0
  26. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell.egg-info/SOURCES.txt +0 -0
  27. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell.egg-info/dependency_links.txt +0 -0
  28. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell.egg-info/entry_points.txt +0 -0
  29. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell.egg-info/requires.txt +0 -0
  30. {flyshell-1.0.7 → flyshell-1.0.8}/src/flyshell.egg-info/top_level.txt +0 -0
  31. {flyshell-1.0.7 → flyshell-1.0.8}/tests/test_auth.py +0 -0
  32. {flyshell-1.0.7 → flyshell-1.0.8}/tests/test_data.py +0 -0
  33. {flyshell-1.0.7 → flyshell-1.0.8}/tests/test_directory.py +0 -0
  34. {flyshell-1.0.7 → flyshell-1.0.8}/tests/test_loader.py +0 -0
  35. {flyshell-1.0.7 → flyshell-1.0.8}/tests/test_security.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.0.7
3
+ Version: 1.0.8
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License: MIT
6
6
  Requires-Python: >=3.10
@@ -0,0 +1,114 @@
1
+ # src\flyshell\builtin\diskops.py
2
+
3
+ from flyshell import constants as c
4
+ from flyshell.abstract.base_cmd import BaseCmd
5
+
6
+ from pathlib import Path
7
+ import os
8
+ import shutil
9
+
10
+
11
+ class Dir(BaseCmd):
12
+ name = "dir"
13
+ description = "List all files in the current working directory"
14
+ min_args = 0
15
+ options = None
16
+ aliases = ["ls"]
17
+
18
+ def execute(self, args):
19
+ try:
20
+ current_path = os.getcwd()
21
+ items = os.listdir(current_path)
22
+ lines = [f"\nDirectory: '{current_path}'"]
23
+ for item in items:
24
+ if os.path.isdir(os.path.join(current_path, item)):
25
+ lines.append(f"[DIR] {item}/")
26
+ else:
27
+ lines.append(f"[FILE] {item}")
28
+ lines.append(f"\nTotal items in directory: {len(items)}\n")
29
+ return (0, "\n".join(lines))
30
+ except Exception as e:
31
+ return (1, f"\nSystem Error: Unable to list directory ({e})\n")
32
+
33
+ class MkDir(BaseCmd):
34
+ name = "mkdir"
35
+ description = "Create a new directory from the current working directory"
36
+ min_args = 1
37
+ options = "Directory name"
38
+ aliases = ["md"]
39
+
40
+ def execute(self, args):
41
+ use_parents = ("-p" in args) or ("--parents" in args)
42
+ path_tokens = [arg for arg in args if arg not in ("-p", "--parents")]
43
+ target = " ".join(path_tokens).strip("\"'")
44
+ try:
45
+ if use_parents:
46
+ os.makedirs(target, exist_ok=True)
47
+ else:
48
+ os.mkdir(target)
49
+ return (0, f"\nSUCCESS! Created directory '{target}'\n")
50
+ except FileExistsError:
51
+ return (1, f"\nSystem Error: Directory '{target}' already exists.\n")
52
+ except FileNotFoundError:
53
+ return (1, f"\nSystem Error: Parent directory does not exist. Use '-p' or '--parents' to create parent directories.\n")
54
+ except PermissionError:
55
+ return (1, f"\nSystem Error: Permission denied. Cannot create '{target}'\n")
56
+ except Exception as e:
57
+ return (1, f"\nSystem Error: Unable to create directory '{target}' ({e})\n")
58
+
59
+
60
+ class RmDir(BaseCmd):
61
+ name = "rmdir"
62
+ description = "Remove the specified directory"
63
+ min_args = 1
64
+ options = "Target directory"
65
+ aliases = []
66
+
67
+ def execute(self, args):
68
+ force = ("-f" in args) or ("--force" in args)
69
+ path_tokens = [arg for arg in args if arg not in ("-f", "--force")]
70
+ raw_target = " ".join(path_tokens).strip("\"'")
71
+ target_path = Path(raw_target).expanduser().resolve()
72
+ if not target_path.exists():
73
+ return (1, f"\nSystem Error: Directory '{raw_target}' not found.\n")
74
+ if not target_path.is_dir():
75
+ return (1, f"\nCommand Error: '{raw_target}' is a file, not a directory.\n")
76
+ if target_path == target_path.anchor or target_path.parent == target_path:
77
+ return (
78
+ 1,
79
+ "\nSecurity Error: Flyshell has blocked this action.\n"
80
+ "You cannot delete the root filesystem directory.\n",
81
+ )
82
+ flyshell_app = c.APP_DIR.resolve()
83
+ flyshell_package = c.PACKAGE_ROOT.resolve()
84
+ if target_path in (flyshell_app, flyshell_package) or flyshell_app in target_path.parents or flyshell_package in target_path.parents:
85
+ return (
86
+ 1,
87
+ "\nSecurity Error: Flyshell has blocked this action.\n"
88
+ f"You cannot delete '{raw_target}' because it contains core Flyshell files or data.\n",
89
+ )
90
+ if target_path == Path(os.getcwd()).resolve():
91
+ return (
92
+ 1,
93
+ "\nSystem Error: Cannot remove current working directory.\n"
94
+ "Switch to a different directory using 'cd' first.\n",
95
+ )
96
+ try:
97
+ has_contents = any(target_path.iterdir())
98
+ if has_contents and not force:
99
+ return (
100
+ 1,
101
+ f"\nDirectory Error: Directory '{raw_target}' is not empty.\n"
102
+ "Use '-f' or '--force' to remove a non-empty directory and its contents.\n",
103
+ )
104
+ if has_contents and force:
105
+ shutil.rmtree(target_path)
106
+ else:
107
+ os.rmdir(target_path)
108
+ return (0, f"\nSUCCESS! Removed directory '{raw_target}'\n")
109
+ except PermissionError:
110
+ return (1, f"\nSystem Error: Permission denied. Cannot delete '{raw_target}'\n")
111
+ except OSError as e:
112
+ return (1, f"\nSystem Error: Unable to remove directory '{raw_target}' ({e.strerror})\n")
113
+ except Exception as e:
114
+ return (1, f"\nSystem Error: Unexpected error removing '{raw_target}' ({e})\n")
@@ -7,8 +7,8 @@ import os
7
7
  import platform
8
8
  import time
9
9
 
10
- BUILD = 106
11
- VERSION = "1.0.7"
10
+ BUILD = 107
11
+ VERSION = "1.0.8"
12
12
 
13
13
 
14
14
  def _resolve_app_dir() -> Path:
@@ -57,8 +57,10 @@ INSTALLED_COMMANDS: list[BaseCmd] = [
57
57
  utils.History(),
58
58
  utils.Kill(),
59
59
  auth.Lock(),
60
+ diskops.MkDir(),
60
61
  system.OpenFile(),
61
62
  utils.Reboot(),
63
+ diskops.RmDir(),
62
64
  utils.Sleep(),
63
65
  system.SysExe(),
64
66
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.0.7
3
+ Version: 1.0.8
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License: MIT
6
6
  Requires-Python: >=3.10
@@ -1,28 +0,0 @@
1
- # src\flyshell\builtin\diskops.py
2
-
3
- from flyshell.abstract.base_cmd import BaseCmd
4
-
5
- import os
6
-
7
-
8
- class Dir(BaseCmd):
9
- name = "dir"
10
- description = "List all files in the current working directory"
11
- min_args = 0
12
- options = None
13
- aliases = ["ls"]
14
-
15
- def execute(self, args):
16
- try:
17
- current_path = os.getcwd()
18
- items = os.listdir(current_path)
19
- lines = [f"\nDirectory: '{current_path}'"]
20
- for item in items:
21
- if os.path.isdir(os.path.join(current_path, item)):
22
- lines.append(f"[DIR] {item}/")
23
- else:
24
- lines.append(f"[FILE] {item}")
25
- lines.append(f"\nTotal items in directory: {len(items)}\n")
26
- return (0, "\n".join(lines))
27
- except Exception as e:
28
- return (1, f"\nSystem Error: Unable to list directory ({e})\n")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes