dekshell 0.2.29__py3-none-any.whl → 0.2.31__py3-none-any.whl

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.
dekshell/core/__init__.py CHANGED
@@ -86,16 +86,21 @@ def shell_command_batch_core(
86
86
  plugin_kwargs=None,
87
87
  source=None
88
88
  ):
89
- def shell_exec(filepath, c=None):
90
- return shell_command_file(
91
- filepath,
92
- context=c or {},
89
+ def shell_kwargs():
90
+ return dict(
93
91
  marker=marker,
94
92
  ms_names=ms_names,
95
93
  marker_set_cls=marker_set_cls,
96
94
  plugin_kwargs=plugin_kwargs,
97
95
  )
98
96
 
97
+ def shell_exec(filepath, c=None):
98
+ return shell_command_file(
99
+ filepath,
100
+ context=c or {},
101
+ **shell_kwargs()
102
+ )
103
+
99
104
  def shell_cmd(cmd, execute=None, env=None):
100
105
  if desc_begin_per:
101
106
  _shell_desc_begin(cmd)
@@ -31,7 +31,7 @@ from dektools.shell import shell_wrapper, is_user_admin, shell_timeout, shell_re
31
31
  from dektools.match import GeneralMatcher, glob2re, glob_compile, glob_match
32
32
  from dektools.cmd.git import git_clean_dir, git_apply, git_parse_modules, git_fetch_min, git_list_remotes, git_head
33
33
  from ...utils.beep import sound_notify
34
- from ...utils.cmd import ak2cmd
34
+ from ...utils.cmd import ak2cmd, pack_context_full
35
35
  from ..markers.base.core import MarkerBase, get_inner_vars
36
36
  from ..markers.invoke import InvokeMarker, GotoMarker
37
37
  from ..redirect import search_bin_by_path_tree
@@ -121,6 +121,21 @@ def _eval_lines(expression, default=_eval_default):
121
121
  return default
122
122
 
123
123
 
124
+ def _invoke(__placeholder__filepath, *args, **kwargs):
125
+ marker_set = get_inner_vars('__inner_marker_set__', full=True)
126
+ filepath = normal_path(__placeholder__filepath)
127
+ cwd = os.getcwd()
128
+ os.chdir(os.path.dirname(filepath))
129
+ ret_value = marker_set.shell_exec(filepath, pack_context_full(args, kwargs))
130
+ os.chdir(cwd)
131
+ return ret_value
132
+
133
+
134
+ def _goto(__placeholder__filepath, *args, **kwargs):
135
+ marker_set = get_inner_vars('__inner_marker_set__', full=True)
136
+ return marker_set.shell_exec(normal_path(__placeholder__filepath), pack_context_full(args, kwargs))
137
+
138
+
124
139
  def _defined(name):
125
140
  default = object()
126
141
  return _eval_mixin(name, default=default) is not default
@@ -234,6 +249,8 @@ default_methods = {
234
249
  'run': shell_wrapper,
235
250
  'eval': _eval_mixin,
236
251
  'exec': _eval_lines,
252
+ 'invoke': _invoke,
253
+ 'goto': _goto,
237
254
  },
238
255
  'path': {
239
256
  **path_common_methods,
@@ -11,6 +11,7 @@ from extra_platforms import current_os as extra_platforms_current_os
11
11
  from dektools.module import ModuleProxy
12
12
  from dektools.time import DateTime
13
13
  from dektools.file import read_text
14
+ from dektools.env import is_on_cicd
14
15
  from ...utils.serializer import serializer
15
16
  from ..redirect import shell_name
16
17
 
@@ -58,8 +59,8 @@ default_properties = {
58
59
  **make_shell_properties(current_shell),
59
60
  'os': {
60
61
  'pid': os.getpid(),
61
- 'win': is_on_win,
62
62
  'ps': os.pathsep,
63
+ 'cicd': is_on_cicd(),
63
64
  },
64
65
  'platform': {
65
66
  'cygwin': sys.platform == 'cygwin',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dekshell
3
- Version: 0.2.29
3
+ Version: 0.2.31
4
4
  Author-Email: sanzenwin <sanzenwin@gmail.com>
5
5
  License: MIT
6
6
  Requires-Python: >=3.8
@@ -1,13 +1,13 @@
1
- dekshell-0.2.29.dist-info/METADATA,sha256=BhyPJENInjdzdb-hqwnsiZKHT8BN-kBMQKUnJ-Nql9I,573
2
- dekshell-0.2.29.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- dekshell-0.2.29.dist-info/entry_points.txt,sha256=d-kbfULiUTZWIBBsrQF3J_-wESncF-4K2rwHT08grlI,75
1
+ dekshell-0.2.31.dist-info/METADATA,sha256=g-axW4y5shPS9aMpAtNsLb-VPflnb1V52EbKlPGcdBc,573
2
+ dekshell-0.2.31.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ dekshell-0.2.31.dist-info/entry_points.txt,sha256=d-kbfULiUTZWIBBsrQF3J_-wESncF-4K2rwHT08grlI,75
4
4
  dekshell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  dekshell/click/__entry__.py,sha256=CMuxUzXoEe4TcHFZwv-MNFwHnu1HSZCDpXFpqQ814uM,42
6
6
  dekshell/click/__init__.py,sha256=rFzB_exzPQaIcbbms5PdHAU3NGdl2MBaYbq9v7g7BOI,1870
7
- dekshell/core/__init__.py,sha256=7d3AjVUGIjXIXRYYiJ03rz5ZONTTojmGfgwpjGmKqtU,5448
7
+ dekshell/core/__init__.py,sha256=acq3wTfUlREzc_9R28ocvJBH7E8cnOQPGpy2dC69fIM,5533
8
8
  dekshell/core/contexts/__init__.py,sha256=ynsfv37azOKfI2UKd0iPl2M6iBW-k5cb1BqSLOWuJpI,482
9
- dekshell/core/contexts/methods.py,sha256=bqKFeK6ZPpGIullMKcG_bh4OKSFTWKE6mD_tZzxDVgY,9722
10
- dekshell/core/contexts/properties.py,sha256=esr51c6wDTDsuFXF2uj7WfyIGSq9H0dzqDqWzeMTNQE,2382
9
+ dekshell/core/contexts/methods.py,sha256=A6t58yBoCEfcQ2rRdmwxwznMpOOGFCUrH8u8RoE2Sow,10375
10
+ dekshell/core/contexts/properties.py,sha256=xBUHC6eDmsoPHmOntxPdHNQpZ3iqd7wzkmyTKWm3ZYA,2422
11
11
  dekshell/core/markers/__init__.py,sha256=yRQazZ1dxMltFao_RQnDnawSnQcjN_4B930MjJhaZ40,1968
12
12
  dekshell/core/markers/base/__init__.py,sha256=mrOgC5glSG60NMpflSi5mb4bXTmDgv2i-ZYUHCef2Nw,13826
13
13
  dekshell/core/markers/base/core.py,sha256=InsUA3md2gC6GyXQsvARfeNTrfbVD3gGOYxTM8VqqPA,11679
@@ -37,4 +37,4 @@ dekshell/utils/cmd.py,sha256=A0lEixQ7Ui0UxmeuymniyqCZXss9qQdX1C0COM7EEkQ,1234
37
37
  dekshell/utils/pkg.py,sha256=TgYqRqawoJfjkxt6UAHnp9ttmpjuHiWRFbqxADOS1VE,1337
38
38
  dekshell/utils/serializer.py,sha256=aIdF2Wzo-qHmIshv46jn1XD0X66vQ1JFdU-g3ZFbH2w,386
39
39
  dekshell/utils/shell.py,sha256=0NoA2-SOOMinbmZZipwzL-npBbzPOdWEfdPVYqq5G5g,92
40
- dekshell-0.2.29.dist-info/RECORD,,
40
+ dekshell-0.2.31.dist-info/RECORD,,