nercone-shell 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl

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.
nercone_shell/__main__.py CHANGED
@@ -17,7 +17,6 @@ import readline
17
17
  import subprocess
18
18
  from pathlib import Path
19
19
  from nercone_modern.color import ModernColor
20
- from nercone_modern.text import ModernText
21
20
  from importlib.metadata import version, PackageNotFoundError
22
21
 
23
22
  try:
@@ -31,6 +30,7 @@ NERSH_HISTORY_PATH = Path(os.environ.get("NERSH_HISTORY_PATH", str(Path(NERSH_PA
31
30
  NERSH_CONFIG: dict = {}
32
31
  NERSH_CONFIG_PATH = Path(os.environ.get("NERSH_CONFIG_PATH", str(Path(NERSH_PATH, "config.json"))))
33
32
  NERSH_CONFIG_DEFAULT: dict = {
33
+ "show_version": True,
34
34
  "override_env": {
35
35
  "SHELL": f"{shutil.which('nersh')}"
36
36
  },
@@ -146,6 +146,9 @@ def shorten_path(path: str) -> str:
146
146
  return f"/{path_str}"
147
147
  return path_str
148
148
 
149
+ def show_version():
150
+ print(f"Nersh v{VERSION}")
151
+
149
152
  def reset():
150
153
  global ENVIRONMENT, NERSH_CONFIG
151
154
  ENVIRONMENT = {"PWD": f"{Path(Path("~").expanduser())}"}
@@ -181,7 +184,11 @@ def run_line(command: str) -> int:
181
184
  args = command.strip().split(" ")
182
185
  cmd = args[0]
183
186
  if cmd == "version":
184
- print(f"Nersh v{VERSION}")
187
+ show_version()
188
+ elif cmd == "reset":
189
+ reset()
190
+ elif cmd == "reload":
191
+ reload()
185
192
  elif cmd == "cd":
186
193
  target = " ".join(args[1:])
187
194
  if not target:
@@ -254,7 +261,9 @@ def main() -> int:
254
261
  else:
255
262
  readline.parse_and_bind("tab: complete")
256
263
  readline.set_completer_delims(' \t\n;')
257
- for p in NERSH_CONFIG.get("autoruns"):
264
+ if NERSH_CONFIG.get("show_version", True):
265
+ show_version()
266
+ for p in NERSH_CONFIG.get("autoruns", []):
258
267
  if Path(p).is_file():
259
268
  with Path(p).open("r") as f:
260
269
  run_script(f.read())
@@ -268,8 +277,7 @@ def main() -> int:
268
277
  readline.read_history_file(NERSH_HISTORY_PATH)
269
278
  while True:
270
279
  try:
271
- command = input(f"{ModernColor.GREEN}{getpass.getuser()}{ModernColor.RESET}@{os.uname()[1].rsplit('.', 1)[0]} {ModernColor.GREEN}{shorten_path(ENVIRONMENT.get('PWD', f'{Path('~').expanduser()}'))}{ModernColor.RESET}> ")
272
- run_line(command)
280
+ run_line(input(f"{ModernColor.color('green')}{getpass.getuser()}{ModernColor.color('reset')}@{os.uname()[1].rsplit('.', 1)[0]} {ModernColor.color('green')}{shorten_path(ENVIRONMENT.get('PWD', f'{Path('~').expanduser()}'))}{ModernColor.color('reset')}> "))
273
281
  except KeyboardInterrupt:
274
282
  print()
275
283
  continue
@@ -0,0 +1,62 @@
1
+ Metadata-Version: 2.3
2
+ Name: nercone-shell
3
+ Version: 0.2.4
4
+ Summary: Modern shell for Developers
5
+ Author: Nercone
6
+ Author-email: Nercone <nercone@diamondgotcat.net>
7
+ License: MIT
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Dist: nercone-modern
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown
14
+
15
+
16
+ <img width="1710" alt="Screenshot" src="https://github.com/user-attachments/assets/a717ebd3-c9d4-447c-86a5-7d33eea9c028" />
17
+
18
+ # Nersh (Nercone Shell)
19
+ Modern shell for Developers
20
+
21
+ ## Requiments
22
+ - CPython 3.9+
23
+ - `uv` [PyPI↗︎](https://pypi.org/project/uv/) or `pip3` [PyPI↗︎](https://pypi.org/project/pip/)
24
+ - `nercone-modern` [PyPI↗︎](https://pypi.org/project/nercone-modern/)
25
+
26
+ ## Installation
27
+
28
+ ### using uv (recommended)
29
+ ```
30
+ uv tool install nercone-shell
31
+ ```
32
+
33
+ ### using pip3
34
+
35
+ **System Python:**
36
+ ```
37
+ pip3 install nercone-shell --break-system-packages
38
+ ```
39
+
40
+ **Venv Python:**
41
+ ```
42
+ pip3 install nercone-shell
43
+ ```
44
+
45
+ ## Update
46
+
47
+ ### using uv (recommended)
48
+ ```
49
+ uv tool install nercone-shell --upgrade
50
+ ```
51
+
52
+ ### using pip3
53
+
54
+ **System Python:**
55
+ ```
56
+ pip3 install nercone-shell --upgrade --break-system-packages
57
+ ```
58
+
59
+ **Venv Python:**
60
+ ```
61
+ pip3 install nercone-shell --upgrade
62
+ ```
@@ -0,0 +1,6 @@
1
+ nercone_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ nercone_shell/__main__.py,sha256=d9hf5f4JhIdoaeuog2UJj0E4ohAJQv3Nz2VHDgtDqA4,9754
3
+ nercone_shell-0.2.4.dist-info/WHEEL,sha256=YUH1mBqsx8Dh2cQG2rlcuRYUhJddG9iClegy4IgnHik,79
4
+ nercone_shell-0.2.4.dist-info/entry_points.txt,sha256=STrGlvrPc2Rr5ktWVfiZ_5Lr7i1GcfOMvsTxL6768sw,55
5
+ nercone_shell-0.2.4.dist-info/METADATA,sha256=rzhryGJXTZGYfq7v00mw6uP6KWuYgA5s0B0tKtnJA0o,1286
6
+ nercone_shell-0.2.4.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: nercone-shell
3
- Version: 0.2.2
4
- Summary: Modern shell for Developers
5
- Author: Nercone
6
- Author-email: Nercone <nercone@diamondgotcat.net>
7
- License: MIT
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Dist: nercone-modern
12
- Requires-Python: >=3.8
13
- Description-Content-Type: text/markdown
14
-
15
- # Nersh (Nercone Shell)
16
- Modern shell for Developers
@@ -1,6 +0,0 @@
1
- nercone_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- nercone_shell/__main__.py,sha256=Ru2-HtdgAq8qJr7UkFykzwH16D0ep2qaEHHODq6vUI8,9567
3
- nercone_shell-0.2.2.dist-info/WHEEL,sha256=YUH1mBqsx8Dh2cQG2rlcuRYUhJddG9iClegy4IgnHik,79
4
- nercone_shell-0.2.2.dist-info/entry_points.txt,sha256=STrGlvrPc2Rr5ktWVfiZ_5Lr7i1GcfOMvsTxL6768sw,55
5
- nercone_shell-0.2.2.dist-info/METADATA,sha256=5tSIq4T9Zml0iB4jYhWvPqikSW_jB_0JSsf89y8s0_c,465
6
- nercone_shell-0.2.2.dist-info/RECORD,,