flyshell 1.2.6__tar.gz → 1.2.7__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 (42) hide show
  1. {flyshell-1.2.6/src/flyshell.egg-info → flyshell-1.2.7}/PKG-INFO +1 -1
  2. flyshell-1.2.7/src/flyshell/builtin/pkg.py +50 -0
  3. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/constants.py +2 -2
  4. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/core/env.py +33 -0
  5. {flyshell-1.2.6 → flyshell-1.2.7/src/flyshell.egg-info}/PKG-INFO +1 -1
  6. {flyshell-1.2.6 → flyshell-1.2.7}/tests/test_pkg.py +2 -2
  7. flyshell-1.2.6/src/flyshell/builtin/pkg.py +0 -33
  8. {flyshell-1.2.6 → flyshell-1.2.7}/LICENSE +0 -0
  9. {flyshell-1.2.6 → flyshell-1.2.7}/README.md +0 -0
  10. {flyshell-1.2.6 → flyshell-1.2.7}/pyproject.toml +0 -0
  11. {flyshell-1.2.6 → flyshell-1.2.7}/setup.cfg +0 -0
  12. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/__init__.py +0 -0
  13. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/abstract/__init__.py +0 -0
  14. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/abstract/base_cmd.py +0 -0
  15. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/abstract/base_plugin.py +0 -0
  16. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/abstract/parent_cmd.py +0 -0
  17. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/builtin/__init__.py +0 -0
  18. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/builtin/diskops.py +0 -0
  19. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/builtin/fs.py +0 -0
  20. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/builtin/system.py +0 -0
  21. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/builtin/utils.py +0 -0
  22. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/core/__init__.py +0 -0
  23. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/core/auth.py +0 -0
  24. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/core/console.py +0 -0
  25. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/core/data.py +0 -0
  26. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/core/directory.py +0 -0
  27. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/core/loader.py +0 -0
  28. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell/main.py +0 -0
  29. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell.egg-info/SOURCES.txt +0 -0
  30. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell.egg-info/dependency_links.txt +0 -0
  31. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell.egg-info/entry_points.txt +0 -0
  32. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell.egg-info/requires.txt +0 -0
  33. {flyshell-1.2.6 → flyshell-1.2.7}/src/flyshell.egg-info/top_level.txt +0 -0
  34. {flyshell-1.2.6 → flyshell-1.2.7}/tests/test_auth.py +0 -0
  35. {flyshell-1.2.6 → flyshell-1.2.7}/tests/test_data.py +0 -0
  36. {flyshell-1.2.6 → flyshell-1.2.7}/tests/test_directory.py +0 -0
  37. {flyshell-1.2.6 → flyshell-1.2.7}/tests/test_diskops.py +0 -0
  38. {flyshell-1.2.6 → flyshell-1.2.7}/tests/test_env_keys.py +0 -0
  39. {flyshell-1.2.6 → flyshell-1.2.7}/tests/test_fs.py +0 -0
  40. {flyshell-1.2.6 → flyshell-1.2.7}/tests/test_loader.py +0 -0
  41. {flyshell-1.2.6 → flyshell-1.2.7}/tests/test_security.py +0 -0
  42. {flyshell-1.2.6 → flyshell-1.2.7}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.2.6
3
+ Version: 1.2.7
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,50 @@
1
+ # src\flyshell\builtin\pkg.py
2
+
3
+ from typing import List, Tuple
4
+ from flyshell.abstract.base_cmd import BaseCmd
5
+ from flyshell.abstract.parent_cmd import ParentCmd
6
+ from flyshell.core import env
7
+
8
+
9
+ class PkgApi(BaseCmd):
10
+ name: str = "api"
11
+ description: str = "View configured package/plugin API keys"
12
+ min_args: int = 1
13
+ options: str = "'add'/'view', then package/key details"
14
+ aliases: List[str] = ["keys"]
15
+
16
+ def execute(self, args: List[str]) -> Tuple[int, str]:
17
+ arg = args[0]
18
+ remaining_args = args[1:]
19
+ match arg:
20
+ case "add":
21
+ if len(remaining_args) < 3:
22
+ return (
23
+ 1,
24
+ "\nCommand Error: Define a package name, a key name and a value.\n",
25
+ )
26
+ plugin_name = remaining_args[0]
27
+ key_name = remaining_args[1]
28
+ val = " ".join(remaining_args[2:])
29
+ code, output = env.set_plugin_api_key(plugin_name, key_name, val)
30
+ return (code, f"\n{output}\n")
31
+ case "view":
32
+ if not remaining_args:
33
+ code, output = env.get_all_keys()
34
+ else:
35
+ package_name = remaining_args[0]
36
+ code, output = env.get_plugin_keys_formatted(package_name)
37
+ return (code, f"\n{output}\n")
38
+ case _:
39
+ return (1, f"\nCommand Error: Unknown target '{arg}'.\n")
40
+
41
+
42
+ class Pkg(ParentCmd):
43
+ name: str = "pkg"
44
+ description: str = "Manage Flyshell packages, plugins, and dependencies"
45
+ aliases: List[str] = ["package"]
46
+
47
+ def get_subcommands(self) -> List[BaseCmd]:
48
+ return [
49
+ PkgApi(),
50
+ ]
@@ -5,8 +5,8 @@ import os
5
5
  import platform
6
6
  import time
7
7
 
8
- BUILD = 131
9
- VERSION = "1.2.6"
8
+ BUILD = 132
9
+ VERSION = "1.2.7"
10
10
 
11
11
 
12
12
  def _resolve_app_dir() -> Path:
@@ -127,3 +127,36 @@ def get_plugin_keys_formatted(target_name: str) -> tuple[int, str]:
127
127
  if k_lower not in seen_keys:
128
128
  lines.append(f"{orig_k} = {val} [Optional/Extra]")
129
129
  return (0, "\n".join(lines))
130
+
131
+
132
+ def set_plugin_api_key(plugin_name: str, key_name: str, value: str) -> tuple[int, str]:
133
+ if not plugin_name or not key_name:
134
+ return (1, "Command Error: Both plugin name and key name are required.")
135
+ target_key = f"{plugin_name.strip().lower()}_{key_name.strip().upper()}"
136
+ clean_val = value.strip().strip("\"'")
137
+ env_path = get_env_path()
138
+ try:
139
+ env_path.parent.mkdir(parents=True, exist_ok=True)
140
+ if not env_path.exists():
141
+ env_path.touch()
142
+ lines = env_path.read_text(encoding="utf-8").splitlines()
143
+ updated = False
144
+ new_lines = []
145
+ for line in lines:
146
+ stripped = line.strip()
147
+ if stripped and not stripped.startswith("#") and "=" in stripped:
148
+ k, _ = stripped.split("=", 1)
149
+ clean_k = k.strip().replace("[", "").replace("]", "")
150
+ if clean_k.lower() == target_key.lower():
151
+ new_lines.append(f"{target_key}={clean_val}")
152
+ updated = True
153
+ continue
154
+ new_lines.append(line)
155
+ if not updated:
156
+ new_lines.append(f"{target_key}={clean_val}")
157
+ env_path.write_text("\n".join(new_lines) + "\n", encoding="utf-8")
158
+ action = "Updated" if updated else "Added"
159
+ return (0, f"SUCCESS! {action.lower()} key '{target_key}'.")
160
+
161
+ except Exception as e:
162
+ return (1, f"File Error: Failed to write to '{env_path}': {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.2.6
3
+ Version: 1.2.7
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License: MIT
6
6
  Requires-Python: >=3.10
@@ -36,7 +36,7 @@ def test_pkg_unknown_subcommand():
36
36
  def test_pkg_api_all_keys(mock_env_file):
37
37
  mock_env_file.write_text("dummy_token=123\n")
38
38
  parent = pkg.Pkg()
39
- code, msg = parent.execute(["api"])
39
+ code, msg = parent.execute(["api", "view"])
40
40
  assert code == 0
41
41
  assert "dummy_token = 123" in msg
42
42
 
@@ -44,7 +44,7 @@ def test_pkg_api_all_keys(mock_env_file):
44
44
  def test_pkg_api_plugin_keys(mock_env_file):
45
45
  mock_env_file.write_text("weather_key=secret\nother_key=skip\n")
46
46
  parent = pkg.Pkg()
47
- code, msg = parent.execute(["api", "weather"])
47
+ code, msg = parent.execute(["api", "view", "weather"])
48
48
  assert code == 0
49
49
  assert "key = secret" in msg
50
50
  assert "other_key" not in msg
@@ -1,33 +0,0 @@
1
- # src\flyshell\builtin\pkg.py
2
-
3
- from typing import List, Tuple
4
- from flyshell.abstract.base_cmd import BaseCmd
5
- from flyshell.abstract.parent_cmd import ParentCmd
6
- from flyshell.core import env
7
-
8
-
9
- class PkgApi(BaseCmd):
10
- name: str = "api"
11
- description: str = "View configured package/plugin API keys"
12
- min_args: int = 0
13
- options: str = "Package name"
14
- aliases: List[str] = ["keys"]
15
-
16
- def execute(self, args: List[str]) -> Tuple[int, str]:
17
- if not args:
18
- code, output = env.get_all_keys()
19
- else:
20
- package_name = args[0]
21
- code, output = env.get_plugin_keys_formatted(package_name)
22
- return (code, f"\n{output}\n")
23
-
24
-
25
- class Pkg(ParentCmd):
26
- name: str = "pkg"
27
- description: str = "Manage Flyshell packages, plugins, and dependencies"
28
- aliases: List[str] = ["package"]
29
-
30
- def get_subcommands(self) -> List[BaseCmd]:
31
- return [
32
- PkgApi(),
33
- ]
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