flyshell 1.2.7__tar.gz → 1.2.9__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.2.7/src/flyshell.egg-info → flyshell-1.2.9}/PKG-INFO +1 -1
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/builtin/fs.py +1 -1
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/builtin/pkg.py +13 -3
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/constants.py +2 -2
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/core/env.py +36 -2
- {flyshell-1.2.7 → flyshell-1.2.9/src/flyshell.egg-info}/PKG-INFO +1 -1
- {flyshell-1.2.7 → flyshell-1.2.9}/LICENSE +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/README.md +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/pyproject.toml +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/setup.cfg +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/__init__.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/abstract/__init__.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/abstract/base_cmd.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/abstract/base_plugin.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/abstract/parent_cmd.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/builtin/__init__.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/builtin/diskops.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/builtin/system.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/builtin/utils.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/core/__init__.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/core/auth.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/core/console.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/core/data.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/core/directory.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/core/loader.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell/main.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell.egg-info/SOURCES.txt +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell.egg-info/dependency_links.txt +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell.egg-info/entry_points.txt +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell.egg-info/requires.txt +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/src/flyshell.egg-info/top_level.txt +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/tests/test_auth.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/tests/test_data.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/tests/test_directory.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/tests/test_diskops.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/tests/test_env_keys.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/tests/test_fs.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/tests/test_loader.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/tests/test_pkg.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/tests/test_security.py +0 -0
- {flyshell-1.2.7 → flyshell-1.2.9}/tests/test_utils.py +0 -0
|
@@ -83,7 +83,7 @@ class FsDel(BaseCmd):
|
|
|
83
83
|
return (0, "\nAll non-auth system data purged successfully.\n")
|
|
84
84
|
return (1, "\nAction cancelled.\n")
|
|
85
85
|
case _:
|
|
86
|
-
return (1, f"\nCommand Error: Unknown target '{target}'
|
|
86
|
+
return (1, f"\nCommand Error: Unknown target '{target}'\n")
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
class FsInfo(BaseCmd):
|
|
@@ -10,14 +10,14 @@ class PkgApi(BaseCmd):
|
|
|
10
10
|
name: str = "api"
|
|
11
11
|
description: str = "View configured package/plugin API keys"
|
|
12
12
|
min_args: int = 1
|
|
13
|
-
options: str = "'add'/'view', then package
|
|
13
|
+
options: str = "'add'/'del'/'edit'/'view', then package name and key name details"
|
|
14
14
|
aliases: List[str] = ["keys"]
|
|
15
15
|
|
|
16
16
|
def execute(self, args: List[str]) -> Tuple[int, str]:
|
|
17
17
|
arg = args[0]
|
|
18
18
|
remaining_args = args[1:]
|
|
19
19
|
match arg:
|
|
20
|
-
case "add":
|
|
20
|
+
case "add" | "edit":
|
|
21
21
|
if len(remaining_args) < 3:
|
|
22
22
|
return (
|
|
23
23
|
1,
|
|
@@ -28,6 +28,16 @@ class PkgApi(BaseCmd):
|
|
|
28
28
|
val = " ".join(remaining_args[2:])
|
|
29
29
|
code, output = env.set_plugin_api_key(plugin_name, key_name, val)
|
|
30
30
|
return (code, f"\n{output}\n")
|
|
31
|
+
case "del" | "rm":
|
|
32
|
+
if len(remaining_args) < 2:
|
|
33
|
+
return (
|
|
34
|
+
1,
|
|
35
|
+
"\nCommand Error: define a package name and a key name for deletion.\n",
|
|
36
|
+
)
|
|
37
|
+
plugin_name = remaining_args[0]
|
|
38
|
+
key_name = remaining_args[1]
|
|
39
|
+
code, output = env.remove_plugin_api_key(plugin_name, key_name)
|
|
40
|
+
return (code, f"\n{output}\n")
|
|
31
41
|
case "view":
|
|
32
42
|
if not remaining_args:
|
|
33
43
|
code, output = env.get_all_keys()
|
|
@@ -36,7 +46,7 @@ class PkgApi(BaseCmd):
|
|
|
36
46
|
code, output = env.get_plugin_keys_formatted(package_name)
|
|
37
47
|
return (code, f"\n{output}\n")
|
|
38
48
|
case _:
|
|
39
|
-
return (1, f"\nCommand Error: Unknown target '{arg}'
|
|
49
|
+
return (1, f"\nCommand Error: Unknown target '{arg}'\n")
|
|
40
50
|
|
|
41
51
|
|
|
42
52
|
class Pkg(ParentCmd):
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# src
|
|
1
|
+
# src\flyshell\core\env.py
|
|
2
2
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from flyshell import constants as c
|
|
@@ -156,7 +156,41 @@ def set_plugin_api_key(plugin_name: str, key_name: str, value: str) -> tuple[int
|
|
|
156
156
|
new_lines.append(f"{target_key}={clean_val}")
|
|
157
157
|
env_path.write_text("\n".join(new_lines) + "\n", encoding="utf-8")
|
|
158
158
|
action = "Updated" if updated else "Added"
|
|
159
|
-
return (0, f"SUCCESS! {action
|
|
159
|
+
return (0, f"SUCCESS! {action} key '{target_key}'")
|
|
160
160
|
|
|
161
161
|
except Exception as e:
|
|
162
162
|
return (1, f"File Error: Failed to write to '{env_path}': {e}")
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def remove_plugin_api_key(plugin_name: str, key_name: str) -> tuple[int, str]:
|
|
166
|
+
if not plugin_name or not key_name:
|
|
167
|
+
return (1, "Command Error: Both plugin name and key name are required.")
|
|
168
|
+
target_key = f"{plugin_name.strip().lower()}_{key_name.strip().lower()}"
|
|
169
|
+
env_path = get_env_path()
|
|
170
|
+
if not env_path.exists():
|
|
171
|
+
return (
|
|
172
|
+
1,
|
|
173
|
+
f"File Config Error: Environment file not found at '{env_path}'",
|
|
174
|
+
)
|
|
175
|
+
try:
|
|
176
|
+
lines = env_path.read_text(encoding="utf-8").splitlines()
|
|
177
|
+
new_lines = []
|
|
178
|
+
found = False
|
|
179
|
+
for line in lines:
|
|
180
|
+
stripped = line.strip()
|
|
181
|
+
if stripped and not stripped.startswith("#") and "=" in stripped:
|
|
182
|
+
k, _ = stripped.split("=", 1)
|
|
183
|
+
clean_k = k.strip().replace("[", "").replace("]", "").lower()
|
|
184
|
+
if clean_k == target_key:
|
|
185
|
+
found = True
|
|
186
|
+
continue
|
|
187
|
+
new_lines.append(line)
|
|
188
|
+
if not found:
|
|
189
|
+
return (
|
|
190
|
+
1,
|
|
191
|
+
f"Command Error: Key '{target_key}' not found in '{env_path.name}'",
|
|
192
|
+
)
|
|
193
|
+
env_path.write_text("\n".join(new_lines) + "\n", encoding="utf-8")
|
|
194
|
+
return (0, f"SUCCESS! Removed key '{target_key}' from Flyshell environment.")
|
|
195
|
+
except Exception as e:
|
|
196
|
+
return (1, f"File Error: Failed to update '{env_path}': {e}")
|
|
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
|