xmyshell 0.2.13__tar.gz → 0.2.15__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.
Files changed (29) hide show
  1. {xmyshell-0.2.13/xmyshell.egg-info → xmyshell-0.2.15}/PKG-INFO +1 -1
  2. {xmyshell-0.2.13 → xmyshell-0.2.15}/pyproject.toml +1 -1
  3. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/completer.py +11 -5
  4. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/data/commands.json +990 -50
  5. xmyshell-0.2.15/xmyshell/injection.py +42 -0
  6. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/main.py +12 -3
  7. {xmyshell-0.2.13 → xmyshell-0.2.15/xmyshell.egg-info}/PKG-INFO +1 -1
  8. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell.egg-info/SOURCES.txt +1 -0
  9. {xmyshell-0.2.13 → xmyshell-0.2.15}/LICENSE +0 -0
  10. {xmyshell-0.2.13 → xmyshell-0.2.15}/README.md +0 -0
  11. {xmyshell-0.2.13 → xmyshell-0.2.15}/setup.cfg +0 -0
  12. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/__init__.py +0 -0
  13. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/__main__.py +0 -0
  14. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/environment.py +0 -0
  15. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/init.py +0 -0
  16. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/kernel.py +0 -0
  17. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/keybindings.py +0 -0
  18. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/lexer.py +0 -0
  19. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/meta.py +0 -0
  20. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/stubs/__init__.py +0 -0
  21. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/stubs/__init__.pyi +0 -0
  22. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/stubs/py.typed +0 -0
  23. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/themes.py +0 -0
  24. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/update.py +0 -0
  25. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell/utils.py +0 -0
  26. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell.egg-info/dependency_links.txt +0 -0
  27. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell.egg-info/entry_points.txt +0 -0
  28. {xmyshell-0.2.13 → xmyshell-0.2.15}/xmyshell.egg-info/requires.txt +0 -0
  29. {xmyshell-0.2.13 → xmyshell-0.2.15}/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.13
3
+ Version: 0.2.15
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xmyshell"
3
- version = "0.2.13"
3
+ version = "0.2.15"
4
4
  description = "XmyShell is a shell-like tool built on top of prompt_toolkit which provides a persistent Python runtime."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -158,7 +158,10 @@ class ShellCompleter(Completer):
158
158
  in_string = in_string or last.startswith('"') or last.startswith("'")
159
159
  last = last.lstrip('"\'')
160
160
  if last == '~': return # don't remove this
161
- path = os.path.expanduser(last)
161
+ try:
162
+ path = os.path.expanduser(shlex.split(last)[0])
163
+ except (ValueError, IndexError):
164
+ path = os.path.expanduser(last)
162
165
  dirname = os.path.dirname(path) or "."
163
166
  prefix = os.path.basename(path).strip('"\'')
164
167
 
@@ -338,7 +341,10 @@ class ShellCompleter(Completer):
338
341
  yield from self._environment_completion(text)
339
342
 
340
343
  def _subcommand_completion(self, text: str):
341
- parts = text.split()
344
+ try:
345
+ parts = shlex.split(text)
346
+ except ValueError:
347
+ parts = text.split()
342
348
  if not parts: return
343
349
  sub_cmd = COMMAND_TREE.get(parts[0])
344
350
  if not sub_cmd: return
@@ -362,7 +368,7 @@ class ShellCompleter(Completer):
362
368
 
363
369
  for name in sorted(sub_cmd.keys()):
364
370
  if name == "_global" or name == "_flags": continue
365
- if name in parts: continue
371
+ if name in parts[:-1]: continue
366
372
  if name.startswith(last_word):
367
373
  yield Completion(
368
374
  name,
@@ -372,7 +378,7 @@ class ShellCompleter(Completer):
372
378
  )
373
379
 
374
380
  for name in sorted(sub_cmd.get("_flags") or set()):
375
- if name in parts: continue
381
+ if name in parts[:-1]: continue
376
382
  if name.startswith(last_word):
377
383
  yield Completion(
378
384
  name,
@@ -382,7 +388,7 @@ class ShellCompleter(Completer):
382
388
  )
383
389
 
384
390
  for name in sorted(global_flags):
385
- if name in parts: continue
391
+ if name in parts[:-1]: continue
386
392
  if name.startswith(last_word):
387
393
  yield Completion(
388
394
  name,