dekshell 0.2.10__tar.gz → 0.2.12__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 (38) hide show
  1. {dekshell-0.2.10 → dekshell-0.2.12}/PKG-INFO +1 -1
  2. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/contexts/methods.py +9 -3
  3. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/__init__.py +1 -1
  4. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/input.py +14 -2
  5. {dekshell-0.2.10 → dekshell-0.2.12}/pyproject.toml +1 -1
  6. {dekshell-0.2.10 → dekshell-0.2.12}/README.md +0 -0
  7. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/__init__.py +0 -0
  8. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/click/__entry__.py +0 -0
  9. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/click/__init__.py +0 -0
  10. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/__init__.py +0 -0
  11. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/contexts/__init__.py +0 -0
  12. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/contexts/properties.py +0 -0
  13. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/base/__init__.py +0 -0
  14. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/base/core.py +0 -0
  15. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/commands.py +0 -0
  16. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/comment.py +0 -0
  17. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/define.py +0 -0
  18. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/echo.py +0 -0
  19. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/empty.py +0 -0
  20. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/env.py +0 -0
  21. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/exec.py +0 -0
  22. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/for_.py +0 -0
  23. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/function.py +0 -0
  24. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/if_.py +0 -0
  25. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/invoke.py +0 -0
  26. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/pip_.py +0 -0
  27. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/redirect.py +0 -0
  28. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/shell.py +0 -0
  29. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/var.py +0 -0
  30. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/markers/while_.py +0 -0
  31. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/plugin/__init__.py +0 -0
  32. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/core/redirect.py +0 -0
  33. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/utils/__init__.py +0 -0
  34. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/utils/beep.py +0 -0
  35. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/utils/cmd.py +0 -0
  36. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/utils/pkg.py +0 -0
  37. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/utils/serializer.py +0 -0
  38. {dekshell-0.2.10 → dekshell-0.2.12}/dekshell/utils/shell.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dekshell
3
- Version: 0.2.10
3
+ Version: 0.2.12
4
4
  Author-Email: sanzenwin <sanzenwin@gmail.com>
5
5
  License: MIT
6
6
  Requires-Python: >=3.8
@@ -22,7 +22,7 @@ from dektools.download import download_from_http
22
22
  from dektools.ps.process import process_detail, process_kill, process_list_all
23
23
  from dektools.time import now
24
24
  from dektools.str import shlex_split, shlex_quote
25
- from dektools.shell import shell_wrapper, is_user_admin
25
+ from dektools.shell import shell_wrapper, is_user_admin, shell_timeout, shell_retry
26
26
  from dektools.match import GeneralMatcher, glob2re, glob_compile, glob_match
27
27
  from dektools.cmd.git import git_clean_dir, git_apply, git_parse_modules, git_fetch_min, git_list_remotes, git_head
28
28
  from ...utils.beep import sound_notify
@@ -169,6 +169,12 @@ default_methods = {
169
169
  'getpass': getpass.getpass,
170
170
  'install': _install,
171
171
  'Path': Path,
172
+ 'sh': {
173
+ 'admin': is_user_admin,
174
+ 'timeout': shell_timeout,
175
+ 'retry': shell_retry,
176
+ 'run': shell_wrapper,
177
+ },
172
178
  'path': {
173
179
  **path_common_methods,
174
180
  'tree': _tree,
@@ -216,7 +222,7 @@ default_methods = {
216
222
 
217
223
  'sys': {
218
224
  'utf8': lambda: sys.stdout.reconfigure(encoding='utf-8'),
219
- 'ak':ak2cmd,
225
+ 'ak': ak2cmd,
220
226
  },
221
227
 
222
228
  'compress': compress_files,
@@ -225,7 +231,7 @@ default_methods = {
225
231
  'func': FuncAnyArgs,
226
232
 
227
233
  'me': lambda x: x,
228
- 'first': lambda x: x[0] if x else None,
234
+ 'first': lambda x, default=None: next(iter(x), default),
229
235
  'true': lambda x=True: _is_true(x),
230
236
  'false': lambda x=False: not _is_true(x),
231
237
 
@@ -24,7 +24,7 @@ def generate_markers(*args, **kwargs):
24
24
  *args,
25
25
  *get_markers_from_modules(**kwargs),
26
26
  ErrorEchoMarker, EchoNoWrapMarker, EchoMarker,
27
- InputMarker,
27
+ InputMarker, InputOnceMarker,
28
28
  DelVarMarker,
29
29
  ExecLinesUpdateMarker, ExecLinesMarker, ExecMarker, ExecCmdcallSimpleLinesMarker, ExecCmdcallLinesMarker,
30
30
  ExecCmdcallMarker, ExecCmdcallChainMarker,
@@ -1,10 +1,10 @@
1
1
  import subprocess
2
- from dektools.shell import shell_with_input
2
+ from dektools.shell import shell_with_input, shell_with_input_once
3
3
  from .base import MarkerWithEnd, MarkerNoTranslator
4
4
 
5
5
 
6
6
  class InputMarker(MarkerWithEnd, MarkerNoTranslator):
7
- tag_head = 'input'
7
+ tag_head = 'inputs'
8
8
 
9
9
  def execute(self, context, command, marker_node, marker_set):
10
10
  command_text = self.get_inner_content(context, marker_node, sep='', translate=True).strip()
@@ -14,3 +14,15 @@ class InputMarker(MarkerWithEnd, MarkerNoTranslator):
14
14
  if rc:
15
15
  raise subprocess.CalledProcessError(rc, command_text)
16
16
  return []
17
+
18
+
19
+ class InputOnceMarker(MarkerWithEnd, MarkerNoTranslator):
20
+ tag_head = 'input'
21
+
22
+ def execute(self, context, command, marker_node, marker_set):
23
+ command_text = self.get_inner_content(context, marker_node, sep='', translate=True).strip()
24
+ inputs = self.split_raw(command, 1, self.tag_head)[1]
25
+ rc = shell_with_input_once(command_text, inputs, env=context.environ_full())[0]
26
+ if rc:
27
+ raise subprocess.CalledProcessError(rc, command_text)
28
+ return []
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dekshell"
3
- version = "0.2.10"
3
+ version = "0.2.12"
4
4
  description = ""
5
5
  authors = [
6
6
  { name = "sanzenwin", email = "sanzenwin@gmail.com" },
File without changes