nercone-shell 0.2.7__py3-none-any.whl → 0.3.0__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
@@ -30,13 +30,19 @@ NERSH_HISTORY_PATH = Path(os.environ.get("NERSH_HISTORY_PATH", str(Path(NERSH_PA
30
30
  NERSH_CONFIG: dict = {}
31
31
  NERSH_CONFIG_PATH = Path(os.environ.get("NERSH_CONFIG_PATH", str(Path(NERSH_PATH, "config.json"))))
32
32
  NERSH_CONFIG_DEFAULT: dict = {
33
- "show_version": True,
34
- "override_env": {
35
- "SHELL": f"{shutil.which('nersh')}"
33
+ "customization": {
34
+ "show_version": True,
35
+ "accent_color": "blue",
36
+ "override_env": {
37
+ "SHELL": f"{shutil.which('nersh')}"
38
+ },
39
+ "autoruns": [
40
+ f"{Path(NERSH_PATH, 'autostart.sh')}"
41
+ ]
36
42
  },
37
- "autoruns": [
38
- f"{Path(NERSH_PATH, 'autostart.sh')}"
39
- ]
43
+ "compatibility": {
44
+ "report_invisible_characters": False
45
+ }
40
46
  }
41
47
 
42
48
  class NershCompleter:
@@ -158,8 +164,10 @@ def reset():
158
164
  def reload():
159
165
  global ENVIRONMENT
160
166
  load_config()
167
+ pwd = ENVIRONMENT.get("PWD")
161
168
  ENVIRONMENT |= os.environ
162
- ENVIRONMENT |= NERSH_CONFIG.get("override_env", {})
169
+ ENVIRONMENT |= {"PWD": pwd}
170
+ ENVIRONMENT |= NERSH_CONFIG.get("customization", {}).get("override_env", {})
163
171
 
164
172
  def load_config() -> dict:
165
173
  global NERSH_CONFIG
@@ -169,7 +177,7 @@ def load_config() -> dict:
169
177
  f.write(json.dumps(NERSH_CONFIG_DEFAULT, indent=4) + "\n")
170
178
  with NERSH_CONFIG_PATH.open("r") as f:
171
179
  NERSH_CONFIG |= json.loads(f.read())
172
- for p in NERSH_CONFIG.get("autoruns", []):
180
+ for p in NERSH_CONFIG.get("customization", {}).get("autoruns", []):
173
181
  if not Path(p).is_file():
174
182
  with Path(p).open("w") as f:
175
183
  f.write("\n")
@@ -261,9 +269,9 @@ def main() -> int:
261
269
  else:
262
270
  readline.parse_and_bind("tab: complete")
263
271
  readline.set_completer_delims(' \t\n;')
264
- if NERSH_CONFIG.get("show_version", True):
272
+ if NERSH_CONFIG.get("customization", {}).get("show_version", True):
265
273
  show_version()
266
- for p in NERSH_CONFIG.get("autoruns", []):
274
+ for p in NERSH_CONFIG.get("customization", {}).get("autoruns", []):
267
275
  if Path(p).is_file():
268
276
  with Path(p).open("r") as f:
269
277
  run_script(f.read())
@@ -275,13 +283,13 @@ def main() -> int:
275
283
  run_script(NERSH_AUTORUN)
276
284
  if NERSH_HISTORY_PATH.is_file():
277
285
  readline.read_history_file(NERSH_HISTORY_PATH)
278
- RL_PROMPT_START_IGNORE = '\001'
279
- RL_PROMPT_END_IGNORE = '\002'
280
- color_green = f"{RL_PROMPT_START_IGNORE}{ModernColor.color('green')}{RL_PROMPT_END_IGNORE}"
286
+ RL_PROMPT_START_IGNORE = "\001" if NERSH_CONFIG.get("compatibility", {}).get("report_invisible_characters", False) else ""
287
+ RL_PROMPT_END_IGNORE = "\002" if NERSH_CONFIG.get("compatibility", {}).get("report_invisible_characters", False) else ""
288
+ color_accent = f"{RL_PROMPT_START_IGNORE}{NERSH_CONFIG.get('customization', {}).get('accent_color', 'blue')}{RL_PROMPT_END_IGNORE}"
281
289
  color_reset = f"{RL_PROMPT_START_IGNORE}{ModernColor.color('reset')}{RL_PROMPT_END_IGNORE}"
282
290
  while True:
283
291
  try:
284
- run_line(input(f"{color_green}{getpass.getuser()}{color_reset}@{os.uname()[1].rsplit('.', 1)[0]} {color_green}{shorten_path(ENVIRONMENT.get('PWD', f'{Path('~').expanduser()}'))}{color_reset}> "))
292
+ run_line(input(f"{color_accent}{getpass.getuser()}{color_reset}@{os.uname()[1].rsplit('.', 1)[0]} {color_accent}{shorten_path(ENVIRONMENT.get('PWD', f'{Path('~').expanduser()}'))}{color_reset}> "))
285
293
  except KeyboardInterrupt:
286
294
  print()
287
295
  continue
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.3
2
+ Name: nercone-shell
3
+ Version: 0.3.0
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
+ ```
63
+
64
+ ## Usage
65
+ ```
66
+ nersh
67
+ ```
68
+
69
+ ## Configuration
70
+ The configuration file is usually located at `~/.nercone/nercone-shell/config.json`.
71
+ If the file does not exist when Nersh starts, it will be automatically created.
72
+
73
+ The following is the default configuration file:
74
+ ```
75
+ {
76
+ "customization": {
77
+ "show_version": true,
78
+ "accent_color": "blue",
79
+ "override_env": {
80
+ "SHELL": "None"
81
+ },
82
+ "autoruns": [
83
+ "<path to home directory>/.nercone/nercone-shell/autostart.sh"
84
+ ]
85
+ },
86
+ "compatibility": {
87
+ "report_invisible_characters": false
88
+ }
89
+ }
90
+ ```
91
+
92
+ ### Customization
93
+ These settings customize the behavior of Nersh.
94
+ - `show_version`: Sets whether to display version information at startup.
95
+ - `accent_color`: Accent color used for prompts etc.
96
+ - `override_env`: Sets the environment variables you want to set at startup in dictionary format.
97
+ - `autoruns`: Sets the shell scripts you want to run at startup in array format.
98
+
99
+ ### Compatibility
100
+ This setting allows Nersh to function properly in special environments.
101
+ - `report_invisible_characters`: A Boolean value that enables reporting of invisible characters to readline, which is necessary in some environments, such as Linux without a GUI (TUI only).
@@ -0,0 +1,6 @@
1
+ nercone_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ nercone_shell/__main__.py,sha256=2LDSGJOMu3Bc5Ja2d9cB7jApUlaNEYdmp-51YNwDqEk,10509
3
+ nercone_shell-0.3.0.dist-info/WHEEL,sha256=YUH1mBqsx8Dh2cQG2rlcuRYUhJddG9iClegy4IgnHik,79
4
+ nercone_shell-0.3.0.dist-info/entry_points.txt,sha256=STrGlvrPc2Rr5ktWVfiZ_5Lr7i1GcfOMvsTxL6768sw,55
5
+ nercone_shell-0.3.0.dist-info/METADATA,sha256=mqXJA5zF2cT_vSsBdgBaG11nHo0oOOdxZx9OjhZEGLQ,2547
6
+ nercone_shell-0.3.0.dist-info/RECORD,,
@@ -1,62 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: nercone-shell
3
- Version: 0.2.7
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
- ```
@@ -1,6 +0,0 @@
1
- nercone_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- nercone_shell/__main__.py,sha256=5ItTAypPFb-AK94Eo_ZvglIjJrGiPYfWJrqK24N3IaI,9956
3
- nercone_shell-0.2.7.dist-info/WHEEL,sha256=YUH1mBqsx8Dh2cQG2rlcuRYUhJddG9iClegy4IgnHik,79
4
- nercone_shell-0.2.7.dist-info/entry_points.txt,sha256=STrGlvrPc2Rr5ktWVfiZ_5Lr7i1GcfOMvsTxL6768sw,55
5
- nercone_shell-0.2.7.dist-info/METADATA,sha256=8e4rcnmbxGpD1VUySdLSdeuKkyjHT_DeP0nxBA10m6Y,1286
6
- nercone_shell-0.2.7.dist-info/RECORD,,