nercone-shell 0.3.6__py3-none-any.whl → 0.3.8__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 +12 -5
- {nercone_shell-0.3.6.dist-info → nercone_shell-0.3.8.dist-info}/METADATA +18 -3
- nercone_shell-0.3.8.dist-info/RECORD +6 -0
- nercone_shell-0.3.6.dist-info/RECORD +0 -6
- {nercone_shell-0.3.6.dist-info → nercone_shell-0.3.8.dist-info}/WHEEL +0 -0
- {nercone_shell-0.3.6.dist-info → nercone_shell-0.3.8.dist-info}/entry_points.txt +0 -0
nercone_shell/__main__.py
CHANGED
|
@@ -28,7 +28,7 @@ except AttributeError:
|
|
|
28
28
|
try:
|
|
29
29
|
VERSION: str = version("nercone-shell")
|
|
30
30
|
except PackageNotFoundError:
|
|
31
|
-
VERSION: str = "
|
|
31
|
+
VERSION: str = "(version unknown)"
|
|
32
32
|
ENVIRONMENT: dict = {}
|
|
33
33
|
NERSH_AUTORUN: str = os.environ.get("NERSH_AUTORUN", None)
|
|
34
34
|
NERSH_PATH = Path(os.environ.get("NERSH_PATH", str(Path(Path("~").expanduser(), ".nercone", "nercone-shell"))))
|
|
@@ -48,6 +48,9 @@ NERSH_CONFIG_DEFAULT: dict = {
|
|
|
48
48
|
},
|
|
49
49
|
"compatibility": {
|
|
50
50
|
"report_invisible_characters": False
|
|
51
|
+
},
|
|
52
|
+
"experimental": {
|
|
53
|
+
"command_history": False
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
|
|
@@ -159,7 +162,7 @@ def shorten_path(path: str) -> str:
|
|
|
159
162
|
return path_str
|
|
160
163
|
|
|
161
164
|
def show_version():
|
|
162
|
-
print(f"Nersh
|
|
165
|
+
print(f"Nersh {VERSION}")
|
|
163
166
|
|
|
164
167
|
def reset():
|
|
165
168
|
global ENVIRONMENT, NERSH_CONFIG
|
|
@@ -253,7 +256,8 @@ def run_line(command: str) -> int:
|
|
|
253
256
|
print(f"nersh: {target}: No such file")
|
|
254
257
|
return 1
|
|
255
258
|
elif cmd == "exit":
|
|
256
|
-
|
|
259
|
+
if NERSH_CONFIG.get("experimental", {}).get("command_history", False):
|
|
260
|
+
readline.write_history_file(str(NERSH_HISTORY_PATH))
|
|
257
261
|
try:
|
|
258
262
|
raise SystemExit(int(args[1]))
|
|
259
263
|
except IndexError:
|
|
@@ -287,7 +291,7 @@ def main() -> int:
|
|
|
287
291
|
print(f"(autorun failed) Not exist: {p}")
|
|
288
292
|
if NERSH_AUTORUN:
|
|
289
293
|
run_script(NERSH_AUTORUN)
|
|
290
|
-
if NERSH_HISTORY_PATH.is_file():
|
|
294
|
+
if NERSH_CONFIG.get("experimental", {}).get("command_history", False) and NERSH_HISTORY_PATH.is_file():
|
|
291
295
|
readline.read_history_file(NERSH_HISTORY_PATH)
|
|
292
296
|
while True:
|
|
293
297
|
try:
|
|
@@ -296,12 +300,15 @@ def main() -> int:
|
|
|
296
300
|
color_accent = f"{RL_PROMPT_START_IGNORE}{ModernColor.color(NERSH_CONFIG.get('customization', {}).get('accent_color', 'blue'))}{RL_PROMPT_END_IGNORE}"
|
|
297
301
|
color_reset = f"{RL_PROMPT_START_IGNORE}{ModernColor.color('reset')}{RL_PROMPT_END_IGNORE}"
|
|
298
302
|
run_line(input(f"{color_accent}{getpass.getuser().lower()}{color_reset}@{hostname.lower()} {color_accent}{shorten_path(ENVIRONMENT.get('PWD', f'{Path('~').expanduser()}'))}{color_reset}> "))
|
|
303
|
+
if not NERSH_CONFIG.get("experimental", {}).get("command_history", False):
|
|
304
|
+
readline.clear_history()
|
|
299
305
|
except KeyboardInterrupt:
|
|
300
306
|
print()
|
|
301
307
|
continue
|
|
302
308
|
except EOFError:
|
|
303
309
|
print()
|
|
304
|
-
|
|
310
|
+
if NERSH_CONFIG.get("experimental", {}).get("command_history", False):
|
|
311
|
+
readline.write_history_file(str(NERSH_HISTORY_PATH))
|
|
305
312
|
break
|
|
306
313
|
|
|
307
314
|
if __name__ == "__main__":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: nercone-shell
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.8
|
|
4
4
|
Summary: Modern shell for Developers
|
|
5
5
|
Author: Nercone
|
|
6
6
|
Author-email: Nercone <nercone@diamondgotcat.net>
|
|
@@ -72,7 +72,7 @@ The configuration file is usually located at `~/.nercone/nercone-shell/config.js
|
|
|
72
72
|
If the file does not exist when Nersh starts, it will be automatically created.
|
|
73
73
|
|
|
74
74
|
The following is the default configuration file:
|
|
75
|
-
```
|
|
75
|
+
```json
|
|
76
76
|
{
|
|
77
77
|
"customization": {
|
|
78
78
|
"show_version": true,
|
|
@@ -86,6 +86,9 @@ The following is the default configuration file:
|
|
|
86
86
|
},
|
|
87
87
|
"compatibility": {
|
|
88
88
|
"report_invisible_characters": false
|
|
89
|
+
},
|
|
90
|
+
"experimental": {
|
|
91
|
+
"command_history": false
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
```
|
|
@@ -98,5 +101,17 @@ These settings customize the behavior of Nersh.
|
|
|
98
101
|
- `autoruns`: Sets the shell scripts you want to run at startup in array format.
|
|
99
102
|
|
|
100
103
|
### Compatibility
|
|
101
|
-
|
|
104
|
+
These settings allows Nersh to function properly in special environments.
|
|
102
105
|
- `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).
|
|
106
|
+
|
|
107
|
+
### Experimental
|
|
108
|
+
The Experimental setting is used to enable experimental features.
|
|
109
|
+
It enables new features that are incomplete, have many bugs, or have unfixable bugs.
|
|
110
|
+
Some features are difficult to completely disable, so they are effectively disabled. (Bugs in external libraries/modules, etc.)
|
|
111
|
+
- `command_history` The readline command history feature.
|
|
112
|
+
- It was marked as an experimental feature because there were frequent issues with the layout collapsing when retracing the history.
|
|
113
|
+
- Since cannot to find a way to disable the history feature in the readline module, it is effectively disabled by clearing the history after each input.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+

|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
nercone_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
nercone_shell/__main__.py,sha256=0Ek8cSs6jklrIHFKkkyCDns1-Gs6fY5a1eKmZDJI0ho,11213
|
|
3
|
+
nercone_shell-0.3.8.dist-info/WHEEL,sha256=YUH1mBqsx8Dh2cQG2rlcuRYUhJddG9iClegy4IgnHik,79
|
|
4
|
+
nercone_shell-0.3.8.dist-info/entry_points.txt,sha256=STrGlvrPc2Rr5ktWVfiZ_5Lr7i1GcfOMvsTxL6768sw,55
|
|
5
|
+
nercone_shell-0.3.8.dist-info/METADATA,sha256=fEJ6xyV8cXxVkncuF4O9AB9GTKfRGnm_VCZxKi5B_No,3386
|
|
6
|
+
nercone_shell-0.3.8.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
nercone_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
nercone_shell/__main__.py,sha256=QHEIi-nwYKJEQyahzGvM-VKParxsPZCUsXtUyYIel2g,10771
|
|
3
|
-
nercone_shell-0.3.6.dist-info/WHEEL,sha256=YUH1mBqsx8Dh2cQG2rlcuRYUhJddG9iClegy4IgnHik,79
|
|
4
|
-
nercone_shell-0.3.6.dist-info/entry_points.txt,sha256=STrGlvrPc2Rr5ktWVfiZ_5Lr7i1GcfOMvsTxL6768sw,55
|
|
5
|
-
nercone_shell-0.3.6.dist-info/METADATA,sha256=ugPpzdN89MDEkarCYi3Dre55jePWke4L2oQTjlTDZTQ,2600
|
|
6
|
-
nercone_shell-0.3.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|