flyshell 1.1.3__tar.gz → 1.1.5__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 (34) hide show
  1. {flyshell-1.1.3/src/flyshell.egg-info → flyshell-1.1.5}/PKG-INFO +1 -1
  2. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/abstract/parent_cmd.py +12 -12
  3. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/builtin/utils.py +3 -4
  4. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/constants.py +2 -2
  5. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/core/auth.py +2 -3
  6. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/core/directory.py +5 -0
  7. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/core/loader.py +1 -1
  8. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/main.py +1 -1
  9. {flyshell-1.1.3 → flyshell-1.1.5/src/flyshell.egg-info}/PKG-INFO +1 -1
  10. {flyshell-1.1.3 → flyshell-1.1.5}/LICENSE +0 -0
  11. {flyshell-1.1.3 → flyshell-1.1.5}/README.md +0 -0
  12. {flyshell-1.1.3 → flyshell-1.1.5}/pyproject.toml +0 -0
  13. {flyshell-1.1.3 → flyshell-1.1.5}/setup.cfg +0 -0
  14. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/__init__.py +0 -0
  15. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/abstract/__init__.py +0 -0
  16. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/abstract/base_cmd.py +0 -0
  17. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/abstract/base_plugin.py +0 -0
  18. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/builtin/__init__.py +0 -0
  19. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/builtin/diskops.py +0 -0
  20. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/builtin/fs.py +0 -0
  21. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/builtin/system.py +0 -0
  22. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/core/__init__.py +0 -0
  23. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/core/console.py +0 -0
  24. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell/core/data.py +0 -0
  25. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell.egg-info/SOURCES.txt +0 -0
  26. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell.egg-info/dependency_links.txt +0 -0
  27. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell.egg-info/entry_points.txt +0 -0
  28. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell.egg-info/requires.txt +0 -0
  29. {flyshell-1.1.3 → flyshell-1.1.5}/src/flyshell.egg-info/top_level.txt +0 -0
  30. {flyshell-1.1.3 → flyshell-1.1.5}/tests/test_auth.py +0 -0
  31. {flyshell-1.1.3 → flyshell-1.1.5}/tests/test_data.py +0 -0
  32. {flyshell-1.1.3 → flyshell-1.1.5}/tests/test_directory.py +0 -0
  33. {flyshell-1.1.3 → flyshell-1.1.5}/tests/test_loader.py +0 -0
  34. {flyshell-1.1.3 → flyshell-1.1.5}/tests/test_security.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.1.3
3
+ Version: 1.1.5
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License: MIT
6
6
  Requires-Python: >=3.10
@@ -43,28 +43,28 @@ class ParentCmd(BaseCmd):
43
43
  f"\nFor subcommand assistance use '{self.name} <subcmd> -h' or '--help'\n"
44
44
  )
45
45
 
46
- def execute(self, args: List[str]) -> Union[int, Tuple[int, str], str, None]:
46
+ def execute(self, args: List[str]) -> Tuple[int, str]:
47
47
  if not args or args[0] in ("-h", "--help"):
48
48
  self.help()
49
- return 0
49
+ return (0, "")
50
50
  sub_name = args[0].lower()
51
51
  sub_args = args[1:]
52
52
  if sub_name not in self._sub_registry:
53
- print(
54
- f"\nCommand Error: Unknown subcommand '{sub_name}' for '{self.name}'."
53
+ err = (
54
+ f"\nCommand Error: Unknown subcommand '{sub_name}' for '{self.name}'.\n"
55
+ f"Use '{self.name} -h' or '--help' to see all valid subcommands.\n"
55
56
  )
56
- print(f"Use '{self.name} -h' or '--help' to see all valid subcommands.\n")
57
- return 1
57
+ return (1, err)
58
58
  target = self._sub_registry[sub_name]
59
59
  if "-h" in sub_args or "--help" in sub_args:
60
60
  target.help(prefix=self.name)
61
- return 0
61
+ return (0, "")
62
62
  if len(sub_args) < target.min_args:
63
- print(
63
+ err_lines = [
64
64
  f"\nCommand Error: '{self.name} {target.name}' requires at least {target.min_args} argument(s)."
65
- )
65
+ ]
66
66
  if target.options:
67
- print(f"Accepted arguments: {target.options}")
68
- print()
69
- return 1
67
+ err_lines.append(f"Accepted arguments: {target.options}")
68
+ err_lines.append("")
69
+ return (1, "\n".join(err_lines))
70
70
  return target.execute(sub_args)
@@ -81,10 +81,8 @@ class Kill(BaseCmd):
81
81
  def execute(self, args):
82
82
  choice = input("\nAre you sure [y/n]?: ").strip().lower()
83
83
  if choice == "y":
84
- print("\nShutting down...")
85
- sys.exit(0)
86
- else:
87
- return (1, "\nAction cancelled.\n")
84
+ return (-1, "\nShutting down...\n")
85
+ return (1, "\nAction cancelled.\n")
88
86
 
89
87
 
90
88
  class Reboot(BaseCmd):
@@ -113,6 +111,7 @@ class Reboot(BaseCmd):
113
111
  signal.signal(signal.SIGINT, old_handler)
114
112
  else:
115
113
  os.execv(cmd[0], cmd)
114
+ return (0, "")
116
115
 
117
116
 
118
117
  class Sleep(BaseCmd):
@@ -5,8 +5,8 @@ import os
5
5
  import platform
6
6
  import time
7
7
 
8
- BUILD = 116
9
- VERSION = "1.1.3"
8
+ BUILD = 118
9
+ VERSION = "1.1.5"
10
10
 
11
11
 
12
12
  def _resolve_app_dir() -> Path:
@@ -102,7 +102,7 @@ def login_flow(is_lock=False) -> bool:
102
102
  i -= 1
103
103
  print("\nAccount Error: Password does not match.")
104
104
  if i == 0:
105
- print("Too many attempts.\n")
105
+ print("Too many attempts.")
106
106
  return False
107
107
  print(f"You have {i} attempts remaining.\n")
108
108
 
@@ -118,5 +118,4 @@ class Lock(BaseCmd):
118
118
  if login_flow(is_lock=True):
119
119
  return (0, "")
120
120
  else:
121
- print("\nShutting down...\n")
122
- sys.exit(0)
121
+ return (-1, "\nShutting down...\n")
@@ -8,6 +8,7 @@ from flyshell.core import auth, data
8
8
 
9
9
  from datetime import datetime, timezone
10
10
  import shlex
11
+ import sys
11
12
 
12
13
 
13
14
  class Cmds(BaseCmd):
@@ -145,6 +146,10 @@ def _execute_single(raw_cmd: str) -> int:
145
146
  code, message = result
146
147
  if message:
147
148
  print(message)
149
+ if code == -1:
150
+ sys.exit(0)
151
+ elif code == -2:
152
+ sys.exit(1)
148
153
  return code
149
154
  elif isinstance(result, int):
150
155
  return result
@@ -1,4 +1,4 @@
1
- # src/flyshell/core/loader.py
1
+ # src\flyshell\core\loader.py
2
2
 
3
3
  from flyshell import constants as c
4
4
  from flyshell.abstract.base_plugin import BasePlugin
@@ -84,7 +84,7 @@ def main():
84
84
  if auth.login_flow():
85
85
  console.boot()
86
86
  else:
87
- print("Shutting down...\n")
87
+ print("\nShutting down...\n")
88
88
  sys.exit(0)
89
89
  else:
90
90
  print(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.1.3
3
+ Version: 1.1.5
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License: MIT
6
6
  Requires-Python: >=3.10
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes