xmyshell 0.2.1__tar.gz → 0.2.2__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.1/xmyshell.egg-info → xmyshell-0.2.2}/PKG-INFO +1 -1
- {xmyshell-0.2.1 → xmyshell-0.2.2}/pyproject.toml +1 -1
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/completer.py +29 -19
- {xmyshell-0.2.1 → xmyshell-0.2.2/xmyshell.egg-info}/PKG-INFO +1 -1
- {xmyshell-0.2.1 → xmyshell-0.2.2}/LICENSE +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/README.md +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/setup.cfg +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/__init__.py +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/__main__.py +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/data/commands.json +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/environment.py +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/init.py +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/kernel.py +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/keybindings.py +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/lexer.py +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/main.py +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/meta.py +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/themes.py +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/update.py +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell/utils.py +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell.egg-info/SOURCES.txt +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell.egg-info/dependency_links.txt +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell.egg-info/entry_points.txt +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell.egg-info/requires.txt +0 -0
- {xmyshell-0.2.1 → xmyshell-0.2.2}/xmyshell.egg-info/top_level.txt +0 -0
|
@@ -16,7 +16,8 @@ MAX_DISPLAY_LEN = 24
|
|
|
16
16
|
MAX_META_LEN = 12
|
|
17
17
|
|
|
18
18
|
BUILTINS = ("cd", "cp", "cat", "echo", "exit", "import", "ls", "print", "pyexec", "pwd", "source",
|
|
19
|
-
"clear", "grep", "find", "from", "mkdir", "rm", "reload", "mv", "help",
|
|
19
|
+
"clear", "grep", "find", "from", "mkdir", "rm", "reload", "mv", "help",
|
|
20
|
+
"update", "alias", "unalias")
|
|
20
21
|
|
|
21
22
|
COMMON = (
|
|
22
23
|
"python", "python3", "pip", "pip3", "git", "conda", "uv",
|
|
@@ -312,6 +313,28 @@ class ShellCompleter(Completer):
|
|
|
312
313
|
display_meta="flag",
|
|
313
314
|
)
|
|
314
315
|
|
|
316
|
+
def _command_completion(self, text):
|
|
317
|
+
for cmd in self._get_commands():
|
|
318
|
+
if cmd in aliases: continue
|
|
319
|
+
if cmd.startswith(text):
|
|
320
|
+
meta = "command" if cmd in BUILTINS else "program"
|
|
321
|
+
yield Completion(
|
|
322
|
+
cmd,
|
|
323
|
+
start_position=-len(text),
|
|
324
|
+
display=truncate(cmd, MAX_DISPLAY_LEN),
|
|
325
|
+
display_meta=meta,
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
def _alias_completion(self, text):
|
|
329
|
+
for alias in aliases.keys():
|
|
330
|
+
if alias.startswith(text):
|
|
331
|
+
yield Completion(
|
|
332
|
+
alias,
|
|
333
|
+
start_position=-len(text),
|
|
334
|
+
display=truncate(alias, MAX_DISPLAY_LEN),
|
|
335
|
+
display_meta="alias",
|
|
336
|
+
)
|
|
337
|
+
|
|
315
338
|
def get_completions(self, document: Document, complete_event):
|
|
316
339
|
text = document.text_before_cursor
|
|
317
340
|
if "=>" in text: return
|
|
@@ -328,24 +351,8 @@ class ShellCompleter(Completer):
|
|
|
328
351
|
if " " not in lstripped:
|
|
329
352
|
if len(lstripped) < 1:
|
|
330
353
|
return
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
yield Completion(
|
|
334
|
-
alias,
|
|
335
|
-
start_position=-len(lstripped),
|
|
336
|
-
display=truncate(alias, MAX_DISPLAY_LEN),
|
|
337
|
-
display_meta="alias",
|
|
338
|
-
)
|
|
339
|
-
for cmd in self._get_commands():
|
|
340
|
-
if cmd in aliases: return
|
|
341
|
-
if cmd.startswith(lstripped):
|
|
342
|
-
meta = "command" if cmd in BUILTINS else "program"
|
|
343
|
-
yield Completion(
|
|
344
|
-
cmd,
|
|
345
|
-
start_position=-len(lstripped),
|
|
346
|
-
display=truncate(cmd, MAX_DISPLAY_LEN),
|
|
347
|
-
display_meta=meta,
|
|
348
|
-
)
|
|
354
|
+
yield from self._alias_completion(lstripped)
|
|
355
|
+
yield from self._command_completion(lstripped)
|
|
349
356
|
|
|
350
357
|
# special built-ins
|
|
351
358
|
parts = lstripped.split()
|
|
@@ -355,6 +362,9 @@ class ShellCompleter(Completer):
|
|
|
355
362
|
param_text = lstripped[len(cmd):].lstrip()
|
|
356
363
|
yield from self._python_completion(param_text)
|
|
357
364
|
return
|
|
365
|
+
if cmd == "unalias":
|
|
366
|
+
param_text = lstripped[len(cmd):].lstrip()
|
|
367
|
+
yield from self._alias_completion(param_text)
|
|
358
368
|
if cmd == "from":
|
|
359
369
|
if not lstripped.endswith(parts[-1]):
|
|
360
370
|
parts.append("")
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|