xmyshell 0.2.9__tar.gz → 0.2.11__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.
- {xmyshell-0.2.9/xmyshell.egg-info → xmyshell-0.2.11}/PKG-INFO +19 -1
- {xmyshell-0.2.9 → xmyshell-0.2.11}/README.md +18 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/pyproject.toml +1 -1
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/kernel.py +11 -1
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/keybindings.py +3 -1
- xmyshell-0.2.11/xmyshell/stubs/__init__.py +1 -0
- xmyshell-0.2.11/xmyshell/stubs/__init__.pyi +15 -0
- xmyshell-0.2.11/xmyshell/stubs/py.typed +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11/xmyshell.egg-info}/PKG-INFO +19 -1
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell.egg-info/SOURCES.txt +4 -1
- {xmyshell-0.2.9 → xmyshell-0.2.11}/LICENSE +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/setup.cfg +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/__init__.py +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/__main__.py +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/completer.py +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/data/commands.json +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/environment.py +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/init.py +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/lexer.py +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/main.py +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/meta.py +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/themes.py +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/update.py +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell/utils.py +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell.egg-info/dependency_links.txt +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell.egg-info/entry_points.txt +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell.egg-info/requires.txt +0 -0
- {xmyshell-0.2.9 → xmyshell-0.2.11}/xmyshell.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xmyshell
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.11
|
|
4
4
|
Summary: XmyShell is a shell-like tool built on top of prompt_toolkit which provides a persistent Python runtime.
|
|
5
5
|
Requires-Python: >=3.12
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -118,6 +118,15 @@ or
|
|
|
118
118
|
❯ unalias ll
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
- Lists, tuples, generators, etc. will be expanded into shell arguments.
|
|
122
|
+
E.g. `{["arg1", "arg2 xxx"]}` will be expanded into `arg1 'arg2 xxx'`
|
|
123
|
+
|
|
124
|
+
Here is an example (though there are other ways to do this, it is just an example )
|
|
125
|
+
```
|
|
126
|
+
❯ pip install {cat("requirements.txt").splitlines()}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
|
|
121
130
|
- Syntax highlighting via `prompt_toolkit`
|
|
122
131
|
- Powerful auto-completion, history search, and automatic bracket/quote pairing
|
|
123
132
|
- Startup configuration: `~/.xmyshell/config.py` loaded at launch
|
|
@@ -170,6 +179,15 @@ The path of config file.
|
|
|
170
179
|
- Auto bracket/parenthesis/quote pairing
|
|
171
180
|
|
|
172
181
|
|
|
182
|
+
### Stubs
|
|
183
|
+
|
|
184
|
+
You can write your xmyshell script with these imports:
|
|
185
|
+
```python
|
|
186
|
+
from xmyshell.themes import ... # themes
|
|
187
|
+
from xmyshell.stubs import ... # stubs for built-in names
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
|
|
173
191
|
## Limitations
|
|
174
192
|
|
|
175
193
|
**XmyShell** is Python‑first. This brings power, but also intentional trade‑offs.
|
|
@@ -108,6 +108,15 @@ or
|
|
|
108
108
|
❯ unalias ll
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
+
- Lists, tuples, generators, etc. will be expanded into shell arguments.
|
|
112
|
+
E.g. `{["arg1", "arg2 xxx"]}` will be expanded into `arg1 'arg2 xxx'`
|
|
113
|
+
|
|
114
|
+
Here is an example (though there are other ways to do this, it is just an example )
|
|
115
|
+
```
|
|
116
|
+
❯ pip install {cat("requirements.txt").splitlines()}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
|
|
111
120
|
- Syntax highlighting via `prompt_toolkit`
|
|
112
121
|
- Powerful auto-completion, history search, and automatic bracket/quote pairing
|
|
113
122
|
- Startup configuration: `~/.xmyshell/config.py` loaded at launch
|
|
@@ -160,6 +169,15 @@ The path of config file.
|
|
|
160
169
|
- Auto bracket/parenthesis/quote pairing
|
|
161
170
|
|
|
162
171
|
|
|
172
|
+
### Stubs
|
|
173
|
+
|
|
174
|
+
You can write your xmyshell script with these imports:
|
|
175
|
+
```python
|
|
176
|
+
from xmyshell.themes import ... # themes
|
|
177
|
+
from xmyshell.stubs import ... # stubs for built-in names
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
|
|
163
181
|
## Limitations
|
|
164
182
|
|
|
165
183
|
**XmyShell** is Python‑first. This brings power, but also intentional trade‑offs.
|
|
@@ -26,9 +26,14 @@ def _run(*args, **kwargs) -> subprocess.CompletedProcess:
|
|
|
26
26
|
# KeyboardInterrupt handler only fires for Ctrl-C at the prompt.
|
|
27
27
|
#
|
|
28
28
|
# Must run on the main thread: signal.signal() is not allowed elsewhere.
|
|
29
|
+
kwargs_preexec = {}
|
|
30
|
+
if os.name == "posix":
|
|
31
|
+
def _reset_sigint():
|
|
32
|
+
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
|
33
|
+
kwargs_preexec["preexec_fn"] = _reset_sigint
|
|
29
34
|
old = signal.signal(signal.SIGINT, signal.SIG_IGN)
|
|
30
35
|
try:
|
|
31
|
-
return subprocess.run(*args, **kwargs)
|
|
36
|
+
return subprocess.run(*args, **kwargs_preexec, **kwargs)
|
|
32
37
|
finally:
|
|
33
38
|
signal.signal(signal.SIGINT, old)
|
|
34
39
|
|
|
@@ -171,8 +176,13 @@ def xmyshell_raw_command(cmd_line: str) -> int | None:
|
|
|
171
176
|
try:
|
|
172
177
|
result = eval(expr, dict(os.environ), namespace)
|
|
173
178
|
print(result)
|
|
179
|
+
namespace["last_error"] = None
|
|
174
180
|
return 0
|
|
175
181
|
except Exception as e:
|
|
182
|
+
import traceback
|
|
183
|
+
|
|
184
|
+
namespace["last_error"] = e
|
|
185
|
+
namespace["last_traceback"] = traceback.format_exc()
|
|
176
186
|
pyerror(f"{type(e).__name__}: {e}")
|
|
177
187
|
return -1
|
|
178
188
|
|
|
@@ -16,7 +16,7 @@ class BufferInfo:
|
|
|
16
16
|
return BufferInfo(buffer.text, buffer.cursor_position)
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
MAX_UNDO_LIST_LEN = 100
|
|
20
20
|
UNDO_MERGE_TIMEOUT = 0.5
|
|
21
21
|
bindings = KeyBindings()
|
|
22
22
|
_auto_editing: bool = False
|
|
@@ -35,6 +35,8 @@ def on_text_changed(buffer: Buffer) -> None:
|
|
|
35
35
|
_redo_list.clear()
|
|
36
36
|
if not _should_merge(buffer):
|
|
37
37
|
_undo_list.append(_last_info)
|
|
38
|
+
while len(_undo_list) > MAX_UNDO_LIST_LEN:
|
|
39
|
+
del _undo_list[0]
|
|
38
40
|
_last_info = BufferInfo.from_buffer(buffer)
|
|
39
41
|
|
|
40
42
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Nothing here
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# XmyShell built-in names
|
|
2
|
+
|
|
3
|
+
def getlogin() -> str: ...
|
|
4
|
+
def getcwd() -> str: ...
|
|
5
|
+
def dirname(p: str) -> str: ...
|
|
6
|
+
def basename(p: str) -> str: ...
|
|
7
|
+
def cat(file_path: str) -> str: ...
|
|
8
|
+
def alias(altname: str, target: str) -> None: ...
|
|
9
|
+
def unalias(altname: str) -> None: ...
|
|
10
|
+
HOME_DIR: str
|
|
11
|
+
PROFILE: str
|
|
12
|
+
exit_code: int
|
|
13
|
+
exec_duration: int
|
|
14
|
+
last_error: Exception | None
|
|
15
|
+
last_traceback: str | None
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xmyshell
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.11
|
|
4
4
|
Summary: XmyShell is a shell-like tool built on top of prompt_toolkit which provides a persistent Python runtime.
|
|
5
5
|
Requires-Python: >=3.12
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -118,6 +118,15 @@ or
|
|
|
118
118
|
❯ unalias ll
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
- Lists, tuples, generators, etc. will be expanded into shell arguments.
|
|
122
|
+
E.g. `{["arg1", "arg2 xxx"]}` will be expanded into `arg1 'arg2 xxx'`
|
|
123
|
+
|
|
124
|
+
Here is an example (though there are other ways to do this, it is just an example )
|
|
125
|
+
```
|
|
126
|
+
❯ pip install {cat("requirements.txt").splitlines()}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
|
|
121
130
|
- Syntax highlighting via `prompt_toolkit`
|
|
122
131
|
- Powerful auto-completion, history search, and automatic bracket/quote pairing
|
|
123
132
|
- Startup configuration: `~/.xmyshell/config.py` loaded at launch
|
|
@@ -170,6 +179,15 @@ The path of config file.
|
|
|
170
179
|
- Auto bracket/parenthesis/quote pairing
|
|
171
180
|
|
|
172
181
|
|
|
182
|
+
### Stubs
|
|
183
|
+
|
|
184
|
+
You can write your xmyshell script with these imports:
|
|
185
|
+
```python
|
|
186
|
+
from xmyshell.themes import ... # themes
|
|
187
|
+
from xmyshell.stubs import ... # stubs for built-in names
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
|
|
173
191
|
## Limitations
|
|
174
192
|
|
|
175
193
|
**XmyShell** is Python‑first. This brings power, but also intentional trade‑offs.
|
|
@@ -20,4 +20,7 @@ xmyshell.egg-info/dependency_links.txt
|
|
|
20
20
|
xmyshell.egg-info/entry_points.txt
|
|
21
21
|
xmyshell.egg-info/requires.txt
|
|
22
22
|
xmyshell.egg-info/top_level.txt
|
|
23
|
-
xmyshell/data/commands.json
|
|
23
|
+
xmyshell/data/commands.json
|
|
24
|
+
xmyshell/stubs/__init__.py
|
|
25
|
+
xmyshell/stubs/__init__.pyi
|
|
26
|
+
xmyshell/stubs/py.typed
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|