nercone-shell 0.2.6__tar.gz → 0.2.8__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.
- {nercone_shell-0.2.6 → nercone_shell-0.2.8}/PKG-INFO +33 -1
- nercone_shell-0.2.8/README.md +80 -0
- {nercone_shell-0.2.6 → nercone_shell-0.2.8}/pyproject.toml +1 -1
- {nercone_shell-0.2.6 → nercone_shell-0.2.8}/src/nercone_shell/__main__.py +22 -15
- nercone_shell-0.2.6/README.md +0 -48
- {nercone_shell-0.2.6 → nercone_shell-0.2.8}/src/nercone_shell/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: nercone-shell
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: Modern shell for Developers
|
|
5
5
|
Author: Nercone
|
|
6
6
|
Author-email: Nercone <nercone@diamondgotcat.net>
|
|
@@ -60,3 +60,35 @@ pip3 install nercone-shell --upgrade --break-system-packages
|
|
|
60
60
|
```
|
|
61
61
|
pip3 install nercone-shell --upgrade
|
|
62
62
|
```
|
|
63
|
+
|
|
64
|
+
## Configuration
|
|
65
|
+
The configuration file is usually located at `~/.nercone/nercone-shell/config.json`.
|
|
66
|
+
If the file does not exist when Nersh starts, it will be automatically created.
|
|
67
|
+
|
|
68
|
+
The following is the default configuration file:
|
|
69
|
+
```
|
|
70
|
+
{
|
|
71
|
+
"customization": {
|
|
72
|
+
"show_version": true,
|
|
73
|
+
"override_env": {
|
|
74
|
+
"SHELL": "None"
|
|
75
|
+
},
|
|
76
|
+
"autoruns": [
|
|
77
|
+
"<path to home directory>/.nercone/nercone-shell/autostart.sh"
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"compatibility": {
|
|
81
|
+
"report_invisible_characters": false
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Customization
|
|
87
|
+
These settings customize the behavior of Nersh.
|
|
88
|
+
- `show_version`: Sets whether to display version information at startup.
|
|
89
|
+
- `override_env`: Sets the environment variables you want to set at startup in dictionary format.
|
|
90
|
+
- `autoruns`: Sets the shell scripts you want to run at startup in array format.
|
|
91
|
+
|
|
92
|
+
### Compatibility
|
|
93
|
+
This setting allows Nersh to function properly in special environments.
|
|
94
|
+
- `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,80 @@
|
|
|
1
|
+
|
|
2
|
+
<img width="1710" alt="Screenshot" src="https://github.com/user-attachments/assets/a717ebd3-c9d4-447c-86a5-7d33eea9c028" />
|
|
3
|
+
|
|
4
|
+
# Nersh (Nercone Shell)
|
|
5
|
+
Modern shell for Developers
|
|
6
|
+
|
|
7
|
+
## Requiments
|
|
8
|
+
- CPython 3.9+
|
|
9
|
+
- `uv` [PyPI↗︎](https://pypi.org/project/uv/) or `pip3` [PyPI↗︎](https://pypi.org/project/pip/)
|
|
10
|
+
- `nercone-modern` [PyPI↗︎](https://pypi.org/project/nercone-modern/)
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
### using uv (recommended)
|
|
15
|
+
```
|
|
16
|
+
uv tool install nercone-shell
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### using pip3
|
|
20
|
+
|
|
21
|
+
**System Python:**
|
|
22
|
+
```
|
|
23
|
+
pip3 install nercone-shell --break-system-packages
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Venv Python:**
|
|
27
|
+
```
|
|
28
|
+
pip3 install nercone-shell
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Update
|
|
32
|
+
|
|
33
|
+
### using uv (recommended)
|
|
34
|
+
```
|
|
35
|
+
uv tool install nercone-shell --upgrade
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### using pip3
|
|
39
|
+
|
|
40
|
+
**System Python:**
|
|
41
|
+
```
|
|
42
|
+
pip3 install nercone-shell --upgrade --break-system-packages
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Venv Python:**
|
|
46
|
+
```
|
|
47
|
+
pip3 install nercone-shell --upgrade
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Configuration
|
|
51
|
+
The configuration file is usually located at `~/.nercone/nercone-shell/config.json`.
|
|
52
|
+
If the file does not exist when Nersh starts, it will be automatically created.
|
|
53
|
+
|
|
54
|
+
The following is the default configuration file:
|
|
55
|
+
```
|
|
56
|
+
{
|
|
57
|
+
"customization": {
|
|
58
|
+
"show_version": true,
|
|
59
|
+
"override_env": {
|
|
60
|
+
"SHELL": "None"
|
|
61
|
+
},
|
|
62
|
+
"autoruns": [
|
|
63
|
+
"<path to home directory>/.nercone/nercone-shell/autostart.sh"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"compatibility": {
|
|
67
|
+
"report_invisible_characters": false
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Customization
|
|
73
|
+
These settings customize the behavior of Nersh.
|
|
74
|
+
- `show_version`: Sets whether to display version information at startup.
|
|
75
|
+
- `override_env`: Sets the environment variables you want to set at startup in dictionary format.
|
|
76
|
+
- `autoruns`: Sets the shell scripts you want to run at startup in array format.
|
|
77
|
+
|
|
78
|
+
### Compatibility
|
|
79
|
+
This setting allows Nersh to function properly in special environments.
|
|
80
|
+
- `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).
|
|
@@ -30,13 +30,18 @@ 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
|
-
"
|
|
34
|
-
|
|
35
|
-
"
|
|
33
|
+
"customization": {
|
|
34
|
+
"show_version": True,
|
|
35
|
+
"override_env": {
|
|
36
|
+
"SHELL": f"{shutil.which('nersh')}"
|
|
37
|
+
},
|
|
38
|
+
"autoruns": [
|
|
39
|
+
f"{Path(NERSH_PATH, 'autostart.sh')}"
|
|
40
|
+
]
|
|
36
41
|
},
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
"compatibility": {
|
|
43
|
+
"report_invisible_characters": False
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
class NershCompleter:
|
|
@@ -158,8 +163,10 @@ def reset():
|
|
|
158
163
|
def reload():
|
|
159
164
|
global ENVIRONMENT
|
|
160
165
|
load_config()
|
|
166
|
+
pwd = ENVIRONMENT.get("PWD")
|
|
161
167
|
ENVIRONMENT |= os.environ
|
|
162
|
-
ENVIRONMENT |=
|
|
168
|
+
ENVIRONMENT |= {"PWD": pwd}
|
|
169
|
+
ENVIRONMENT |= NERSH_CONFIG.get("customization", {}).get("override_env", {})
|
|
163
170
|
|
|
164
171
|
def load_config() -> dict:
|
|
165
172
|
global NERSH_CONFIG
|
|
@@ -169,7 +176,7 @@ def load_config() -> dict:
|
|
|
169
176
|
f.write(json.dumps(NERSH_CONFIG_DEFAULT, indent=4) + "\n")
|
|
170
177
|
with NERSH_CONFIG_PATH.open("r") as f:
|
|
171
178
|
NERSH_CONFIG |= json.loads(f.read())
|
|
172
|
-
for p in NERSH_CONFIG.get("autoruns", []):
|
|
179
|
+
for p in NERSH_CONFIG.get("customization", {}).get("autoruns", []):
|
|
173
180
|
if not Path(p).is_file():
|
|
174
181
|
with Path(p).open("w") as f:
|
|
175
182
|
f.write("\n")
|
|
@@ -261,9 +268,9 @@ def main() -> int:
|
|
|
261
268
|
else:
|
|
262
269
|
readline.parse_and_bind("tab: complete")
|
|
263
270
|
readline.set_completer_delims(' \t\n;')
|
|
264
|
-
if NERSH_CONFIG.get("show_version", True):
|
|
271
|
+
if NERSH_CONFIG.get("customization", {}).get("show_version", True):
|
|
265
272
|
show_version()
|
|
266
|
-
for p in NERSH_CONFIG.get("autoruns", []):
|
|
273
|
+
for p in NERSH_CONFIG.get("customization", {}).get("autoruns", []):
|
|
267
274
|
if Path(p).is_file():
|
|
268
275
|
with Path(p).open("r") as f:
|
|
269
276
|
run_script(f.read())
|
|
@@ -275,13 +282,13 @@ def main() -> int:
|
|
|
275
282
|
run_script(NERSH_AUTORUN)
|
|
276
283
|
if NERSH_HISTORY_PATH.is_file():
|
|
277
284
|
readline.read_history_file(NERSH_HISTORY_PATH)
|
|
278
|
-
RL_PROMPT_START_IGNORE =
|
|
279
|
-
RL_PROMPT_END_IGNORE =
|
|
280
|
-
|
|
281
|
-
|
|
285
|
+
RL_PROMPT_START_IGNORE = "\001" if NERSH_CONFIG.get("compatibility", {}).get("report_invisible_characters", False) else ""
|
|
286
|
+
RL_PROMPT_END_IGNORE = "\002" if NERSH_CONFIG.get("compatibility", {}).get("report_invisible_characters", False) else ""
|
|
287
|
+
color_green = f"{RL_PROMPT_START_IGNORE}{ModernColor.color('green')}{RL_PROMPT_END_IGNORE}"
|
|
288
|
+
color_reset = f"{RL_PROMPT_START_IGNORE}{ModernColor.color('reset')}{RL_PROMPT_END_IGNORE}"
|
|
282
289
|
while True:
|
|
283
290
|
try:
|
|
284
|
-
run_line(input(f"{
|
|
291
|
+
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}> "))
|
|
285
292
|
except KeyboardInterrupt:
|
|
286
293
|
print()
|
|
287
294
|
continue
|
nercone_shell-0.2.6/README.md
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<img width="1710" alt="Screenshot" src="https://github.com/user-attachments/assets/a717ebd3-c9d4-447c-86a5-7d33eea9c028" />
|
|
3
|
-
|
|
4
|
-
# Nersh (Nercone Shell)
|
|
5
|
-
Modern shell for Developers
|
|
6
|
-
|
|
7
|
-
## Requiments
|
|
8
|
-
- CPython 3.9+
|
|
9
|
-
- `uv` [PyPI↗︎](https://pypi.org/project/uv/) or `pip3` [PyPI↗︎](https://pypi.org/project/pip/)
|
|
10
|
-
- `nercone-modern` [PyPI↗︎](https://pypi.org/project/nercone-modern/)
|
|
11
|
-
|
|
12
|
-
## Installation
|
|
13
|
-
|
|
14
|
-
### using uv (recommended)
|
|
15
|
-
```
|
|
16
|
-
uv tool install nercone-shell
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### using pip3
|
|
20
|
-
|
|
21
|
-
**System Python:**
|
|
22
|
-
```
|
|
23
|
-
pip3 install nercone-shell --break-system-packages
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**Venv Python:**
|
|
27
|
-
```
|
|
28
|
-
pip3 install nercone-shell
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Update
|
|
32
|
-
|
|
33
|
-
### using uv (recommended)
|
|
34
|
-
```
|
|
35
|
-
uv tool install nercone-shell --upgrade
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### using pip3
|
|
39
|
-
|
|
40
|
-
**System Python:**
|
|
41
|
-
```
|
|
42
|
-
pip3 install nercone-shell --upgrade --break-system-packages
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
**Venv Python:**
|
|
46
|
-
```
|
|
47
|
-
pip3 install nercone-shell --upgrade
|
|
48
|
-
```
|
|
File without changes
|