flyshell 1.5.4__tar.gz → 1.5.6__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.5.4/src/flyshell.egg-info → flyshell-1.5.6}/PKG-INFO +1 -1
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/__init__.py +0 -1
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/abstract/base_cmd.py +7 -1
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/abstract/base_plugin.py +5 -2
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/abstract/parent_cmd.py +1 -2
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/builtin/utils.py +11 -1
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/constants.py +3 -3
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/core/data.py +3 -1
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/core/directory.py +1 -1
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/native/diskops_bridge.py +1 -1
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/startup/deps.py +1 -1
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/startup/env.py +1 -1
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/startup/loader.py +3 -3
- {flyshell-1.5.4 → flyshell-1.5.6/src/flyshell.egg-info}/PKG-INFO +1 -1
- {flyshell-1.5.4 → flyshell-1.5.6}/tests/test_utils.py +7 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/LICENSE +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/MANIFEST.in +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/README.md +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/diskops.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/posix/cat.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/posix/cp.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/posix/dir.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/posix/mkdir.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/posix/mv.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/posix/rename.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/posix/rm.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/posix/rmdir.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/posix/touch.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/shared/dir_types.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/shared/dir_types.h +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/shared/native_errors.h +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/shared/win32_utf.h +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/win32/cat.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/win32/cp.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/win32/dir.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/win32/mkdir.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/win32/mv.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/win32/rename.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/win32/rm.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/win32/rmdir.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/c_src/diskops/win32/touch.c +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/pyproject.toml +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/setup.cfg +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/setup.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/abstract/__init__.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/accounts/__init__.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/accounts/auth.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/bin/__init__.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/builtin/__init__.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/builtin/fs.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/builtin/pkg.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/builtin/system.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/core/__init__.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/core/console.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/main.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/native/__init__.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/native/diskops_handler.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/native/legacy/__init__.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/native/legacy/diskops.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell/startup/__init__.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell.egg-info/SOURCES.txt +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell.egg-info/dependency_links.txt +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell.egg-info/entry_points.txt +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell.egg-info/requires.txt +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/src/flyshell.egg-info/top_level.txt +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/tests/test_auth.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/tests/test_data.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/tests/test_deps.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/tests/test_directory.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/tests/test_diskops_ext.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/tests/test_diskops_lgc.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/tests/test_env.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/tests/test_fs.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/tests/test_loader.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/tests/test_pkg.py +0 -0
- {flyshell-1.5.4 → flyshell-1.5.6}/tests/test_security.py +0 -0
|
@@ -8,7 +8,13 @@ class BaseCmd:
|
|
|
8
8
|
description: str = ""
|
|
9
9
|
min_args: int = 0
|
|
10
10
|
options: Optional[str] = None
|
|
11
|
-
aliases: List[str] =
|
|
11
|
+
aliases: Optional[List[str]] = None
|
|
12
|
+
|
|
13
|
+
def __init__(self):
|
|
14
|
+
if self.aliases is None:
|
|
15
|
+
self.aliases = []
|
|
16
|
+
else:
|
|
17
|
+
self.aliases = list(self.aliases)
|
|
12
18
|
|
|
13
19
|
def execute(self, args: List[str]) -> Tuple[int, str]:
|
|
14
20
|
raise NotImplementedError(
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from flyshell.core import data
|
|
4
4
|
|
|
5
5
|
from pathlib import Path
|
|
6
|
+
from typing import Optional
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class BasePlugin:
|
|
@@ -13,10 +14,12 @@ class BasePlugin:
|
|
|
13
14
|
identifier: str = ""
|
|
14
15
|
usage: str = ""
|
|
15
16
|
extended_help: str = ""
|
|
16
|
-
api_keys: list =
|
|
17
|
-
third_pty_libs: list =
|
|
17
|
+
api_keys: Optional[list] = None
|
|
18
|
+
third_pty_libs: Optional[list] = None
|
|
18
19
|
|
|
19
20
|
def __init__(self, context: dict):
|
|
21
|
+
self.api_keys = list(self.api_keys) if self.api_keys else []
|
|
22
|
+
self.third_pty_libs = list(self.third_pty_libs) if self.third_pty_libs else []
|
|
20
23
|
self.context = context
|
|
21
24
|
self.plugin_name = context.get("plugin_name", self.name)
|
|
22
25
|
self.storage = context.get("storage", {})
|
|
@@ -7,10 +7,9 @@ from typing import Dict, List, Tuple
|
|
|
7
7
|
|
|
8
8
|
class ParentCmd(BaseCmd):
|
|
9
9
|
min_args: int = 1
|
|
10
|
-
subcommands: Dict[str, BaseCmd] = {}
|
|
11
10
|
|
|
12
11
|
def __init__(self):
|
|
13
|
-
super().__init__()
|
|
12
|
+
super().__init__()
|
|
14
13
|
self._sub_registry: Dict[str, BaseCmd] = {}
|
|
15
14
|
self._build_registry()
|
|
16
15
|
|
|
@@ -4,7 +4,9 @@ from flyshell import constants as c
|
|
|
4
4
|
from flyshell.abstract.base_cmd import BaseCmd
|
|
5
5
|
from flyshell.core import data
|
|
6
6
|
|
|
7
|
+
import codecs
|
|
7
8
|
import os
|
|
9
|
+
import re
|
|
8
10
|
import signal
|
|
9
11
|
import subprocess
|
|
10
12
|
import sys
|
|
@@ -22,6 +24,11 @@ class Clear(BaseCmd):
|
|
|
22
24
|
return (0, c.CLEAR_SCREEN)
|
|
23
25
|
|
|
24
26
|
|
|
27
|
+
_ESCAPE_SEQ_RE = re.compile(
|
|
28
|
+
r"\\(n|r|t|b|f|a|v|\\|'|\"|[0-7]{1,3}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})"
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
25
32
|
class Echo(BaseCmd):
|
|
26
33
|
name = "echo"
|
|
27
34
|
description = "Print arguments to terminal"
|
|
@@ -32,7 +39,10 @@ class Echo(BaseCmd):
|
|
|
32
39
|
def execute(self, args):
|
|
33
40
|
text = " ".join(args)
|
|
34
41
|
try:
|
|
35
|
-
text =
|
|
42
|
+
text = _ESCAPE_SEQ_RE.sub(
|
|
43
|
+
lambda m: codecs.decode(m.group(0), "unicode_escape"),
|
|
44
|
+
text,
|
|
45
|
+
)
|
|
36
46
|
except Exception:
|
|
37
47
|
pass
|
|
38
48
|
return (0, f"\n{text}\n")
|
|
@@ -26,7 +26,9 @@ def _get_connection(filename=c.FILE_PATH):
|
|
|
26
26
|
return conn
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
def initialise(filename=c.FILE_PATH, initialised=
|
|
29
|
+
def initialise(filename=c.FILE_PATH, initialised=None):
|
|
30
|
+
if initialised is None:
|
|
31
|
+
initialised = c.INITIALISED
|
|
30
32
|
target = str(filename)
|
|
31
33
|
if target in initialised:
|
|
32
34
|
return
|
|
@@ -165,7 +165,7 @@ def _execute_single(raw_cmd: str) -> int:
|
|
|
165
165
|
elif cmd_name in c.PLUGINS:
|
|
166
166
|
log(raw_cmd)
|
|
167
167
|
plugin = c.PLUGINS[cmd_name]
|
|
168
|
-
required_keys = getattr(plugin, "api_keys", []
|
|
168
|
+
required_keys = getattr(plugin, "api_keys", None) or []
|
|
169
169
|
available_keys = getattr(plugin, "api_keys_data", {})
|
|
170
170
|
available_lower = {k.lower() for k in available_keys}
|
|
171
171
|
missing = [k for k in required_keys if k.lower() not in available_lower]
|
|
@@ -46,4 +46,4 @@ def translate_error(code: int, target: str = "") -> tuple[int, str]:
|
|
|
46
46
|
target_str = f"for '{target}'" if target else ""
|
|
47
47
|
if target_str:
|
|
48
48
|
return (1, f"\n{category}: {default_msg} {target_str}\n")
|
|
49
|
-
return (1, f"\n{category}: {default_msg}
|
|
49
|
+
return (1, f"\n{category}: {default_msg}.\n")
|
|
@@ -13,7 +13,7 @@ def check_module_installed(module_name: str) -> bool:
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def verify_plugin_dependencies(plugin) -> Tuple[List[str], List[str]]:
|
|
16
|
-
declared = getattr(plugin, "third_pty_libs", []
|
|
16
|
+
declared = getattr(plugin, "third_pty_libs", None) or []
|
|
17
17
|
installed = []
|
|
18
18
|
missing = []
|
|
19
19
|
for dep in declared:
|
|
@@ -119,7 +119,7 @@ def get_plugin_keys_formatted(target_name: str) -> tuple[int, str]:
|
|
|
119
119
|
return (1, f"File Config Error: Environment file not found at '{env_path}'.")
|
|
120
120
|
dir_name, plugin = _resolve_plugin_dir_name(target_name)
|
|
121
121
|
configured_keys = get_plugin_api_keys(target_name)
|
|
122
|
-
required_keys = getattr(plugin, "api_keys", []) if plugin else []
|
|
122
|
+
required_keys = (getattr(plugin, "api_keys", None) or []) if plugin else []
|
|
123
123
|
if not configured_keys and not required_keys:
|
|
124
124
|
return (0, f"No API keys found or required for plugin '{target_name}'.")
|
|
125
125
|
lines = [f"API Keys for plugin '{target_name}' (folder: '{dir_name}'):"]
|
|
@@ -62,7 +62,7 @@ def scan_plugins(plugin_folder=None):
|
|
|
62
62
|
)
|
|
63
63
|
break
|
|
64
64
|
ctx = build_context(resolved_name, default_name, file_path)
|
|
65
|
-
required_keys = getattr(obj, "api_keys", []
|
|
65
|
+
required_keys = getattr(obj, "api_keys", None) or []
|
|
66
66
|
found_keys = ctx["api_keys"]
|
|
67
67
|
found_keys_lower = {k.lower(): v for k, v in found_keys.items()}
|
|
68
68
|
missing_keys = [
|
|
@@ -136,7 +136,7 @@ def check_plugin_api_keys():
|
|
|
136
136
|
print("\nFlyshell will now check plugin API keys.")
|
|
137
137
|
has_keys_to_report = False
|
|
138
138
|
for identifier, plugin in c.PLUGINS.items():
|
|
139
|
-
required_keys = getattr(plugin, "api_keys", []
|
|
139
|
+
required_keys = getattr(plugin, "api_keys", None) or []
|
|
140
140
|
configured_keys = getattr(plugin, "api_keys_data", {})
|
|
141
141
|
dir_name = plugin.context.get("plugin_dir_name", identifier)
|
|
142
142
|
if not required_keys and not configured_keys:
|
|
@@ -168,7 +168,7 @@ def check_all_plugin_dependencies() -> Dict[str, List[str]]:
|
|
|
168
168
|
plugins_with_deps = False
|
|
169
169
|
all_missing: Dict[str, List[str]] = {}
|
|
170
170
|
for identifier, plugin in c.PLUGINS.items():
|
|
171
|
-
declared = getattr(plugin, "third_pty_libs", []
|
|
171
|
+
declared = getattr(plugin, "third_pty_libs", None) or []
|
|
172
172
|
if not declared:
|
|
173
173
|
continue
|
|
174
174
|
plugins_with_deps = True
|
|
@@ -14,6 +14,13 @@ def test_echo_output_and_escape_characters():
|
|
|
14
14
|
assert "Line1\nLine2" in msg
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
def test_echo_non_ascii_characters():
|
|
18
|
+
cmd = utils.Echo()
|
|
19
|
+
code, msg = cmd.execute([r"héllo 🚀\nworld"])
|
|
20
|
+
assert code == 0
|
|
21
|
+
assert "héllo 🚀\nworld" in msg
|
|
22
|
+
|
|
23
|
+
|
|
17
24
|
def test_clear_returns_escape_code():
|
|
18
25
|
cmd = utils.Clear()
|
|
19
26
|
code, msg = cmd.execute([])
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|