xmyshell 0.2.12__tar.gz → 0.2.13__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 (28) hide show
  1. {xmyshell-0.2.12/xmyshell.egg-info → xmyshell-0.2.13}/PKG-INFO +1 -1
  2. {xmyshell-0.2.12 → xmyshell-0.2.13}/pyproject.toml +1 -1
  3. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/kernel.py +19 -8
  4. {xmyshell-0.2.12 → xmyshell-0.2.13/xmyshell.egg-info}/PKG-INFO +1 -1
  5. {xmyshell-0.2.12 → xmyshell-0.2.13}/LICENSE +0 -0
  6. {xmyshell-0.2.12 → xmyshell-0.2.13}/README.md +0 -0
  7. {xmyshell-0.2.12 → xmyshell-0.2.13}/setup.cfg +0 -0
  8. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/__init__.py +0 -0
  9. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/__main__.py +0 -0
  10. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/completer.py +0 -0
  11. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/data/commands.json +0 -0
  12. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/environment.py +0 -0
  13. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/init.py +0 -0
  14. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/keybindings.py +0 -0
  15. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/lexer.py +0 -0
  16. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/main.py +0 -0
  17. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/meta.py +0 -0
  18. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/stubs/__init__.py +0 -0
  19. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/stubs/__init__.pyi +0 -0
  20. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/stubs/py.typed +0 -0
  21. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/themes.py +0 -0
  22. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/update.py +0 -0
  23. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell/utils.py +0 -0
  24. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell.egg-info/SOURCES.txt +0 -0
  25. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell.egg-info/dependency_links.txt +0 -0
  26. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell.egg-info/entry_points.txt +0 -0
  27. {xmyshell-0.2.12 → xmyshell-0.2.13}/xmyshell.egg-info/requires.txt +0 -0
  28. {xmyshell-0.2.12 → xmyshell-0.2.13}/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.12
3
+ Version: 0.2.13
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.12"
3
+ version = "0.2.13"
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"
@@ -2,6 +2,7 @@ from collections.abc import Generator, Sequence
2
2
  from contextlib import contextmanager
3
3
  import os
4
4
  import sys
5
+ import re
5
6
  import runpy
6
7
  import subprocess
7
8
  import signal
@@ -322,21 +323,31 @@ def xmyshell(cmd_line: str) -> int:
322
323
  try:
323
324
  target_dir = os.path.expanduser(target_dir)
324
325
  # only works on Windows
325
- if os.name == "nt" and target_dir.startswith("/"):
326
- import re
327
-
326
+ if os.name == "nt":
328
327
  if target_dir.startswith("/"):
329
- m = re.match(r"^/([a-zA-Z])/", target_dir)
328
+ m = re.match(r"^/([a-zA-Z])(/.*)?$", target_dir)
330
329
  if m:
331
330
  drive = m.group(1).upper()
332
- target_dir = drive + ":/" + target_dir[3:]
333
- os.chdir(target_dir)
331
+ rest = m.group(2) or ""
332
+ target_dir = drive + ":" + rest
333
+ target_dir = target_dir.replace("\\", "/")
334
+ _splited = shlex.split(target_dir)
335
+ if len(_splited) > 1:
336
+ pyerror("too many arguments")
337
+ return -1
338
+ os.chdir(_splited[0])
334
339
  return 0
335
340
  except FileNotFoundError:
336
- pyerror(f"file not found: '{target_dir}'")
341
+ pyerror(f"file not found: {target_dir!r}")
337
342
  return -1
338
343
  except NotADirectoryError:
339
- pyerror(f"not a directory: '{target_dir}'")
344
+ pyerror(f"not a directory: {target_dir!r}")
345
+ return -1
346
+ except PermissionError:
347
+ pyerror(f"permission denied: {target_dir!r}")
348
+ return -1
349
+ except (OSError, ValueError):
350
+ pyerror(f"wrong path format: {target_dir!r}")
340
351
  return -1
341
352
 
342
353
  case "source":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xmyshell
3
- Version: 0.2.12
3
+ Version: 0.2.13
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
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