dekshell 0.2.28__py3-none-any.whl → 0.2.30__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)
@@ -14,6 +14,7 @@ from dektools.file import sure_dir, write_file, read_text, remove_path, sure_par
14
14
  format_path_desc, read_file, split_ext, path_ext, clear_dir, copy_recurse_ignore, path_is_empty, \
15
15
  read_lines, seek_py_module_path, come_real_path, status_of_dir, diff_of_dir, path_parent, \
16
16
  split_file, combine_split_files, remove_split_files, meta_split_file, tree, iglob, \
17
+ iter_dir_type, iter_dir_type_one, \
17
18
  where, where_list, which, which_list
18
19
  from dektools.hash import hash_file
19
20
  from dektools.zip import compress_files, decompress_files
@@ -30,7 +31,7 @@ from dektools.shell import shell_wrapper, is_user_admin, shell_timeout, shell_re
30
31
  from dektools.match import GeneralMatcher, glob2re, glob_compile, glob_match
31
32
  from dektools.cmd.git import git_clean_dir, git_apply, git_parse_modules, git_fetch_min, git_list_remotes, git_head
32
33
  from ...utils.beep import sound_notify
33
- from ...utils.cmd import ak2cmd
34
+ from ...utils.cmd import ak2cmd, pack_context_full
34
35
  from ..markers.base.core import MarkerBase, get_inner_vars
35
36
  from ..markers.invoke import InvokeMarker, GotoMarker
36
37
  from ..redirect import search_bin_by_path_tree
@@ -120,6 +121,21 @@ def _eval_lines(expression, default=_eval_default):
120
121
  return default
121
122
 
122
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
+
123
139
  def _defined(name):
124
140
  default = object()
125
141
  return _eval_mixin(name, default=default) is not default
@@ -233,6 +249,8 @@ default_methods = {
233
249
  'run': shell_wrapper,
234
250
  'eval': _eval_mixin,
235
251
  'exec': _eval_lines,
252
+ 'invoke': _invoke,
253
+ 'goto': _goto,
236
254
  },
237
255
  'path': {
238
256
  **path_common_methods,
@@ -252,8 +270,8 @@ default_methods = {
252
270
  'mdt': lambda x=None: tempfile.mkdtemp(prefix=x),
253
271
  'mdc': _sure_and_clear,
254
272
 
255
- 'lsa': lambda path='.', file=None: list(_iter_dir(path, file)),
256
- 'lso': lambda path='.', file=None: _list_dir_one(path, file) or '',
273
+ 'lsa': iter_dir_type,
274
+ 'lso': lambda path='.', file=None: iter_dir_type_one(path, file, ''),
257
275
  'ls': lambda x='.': os.listdir(x),
258
276
 
259
277
  'iglob': iglob,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dekshell
3
- Version: 0.2.28
3
+ Version: 0.2.30
4
4
  Author-Email: sanzenwin <sanzenwin@gmail.com>
5
5
  License: MIT
6
6
  Requires-Python: >=3.8
@@ -1,12 +1,12 @@
1
- dekshell-0.2.28.dist-info/METADATA,sha256=TM4EKPhD61p--WPgJ-nnOTdYLF5dOGjujW-iVFA2fIU,573
2
- dekshell-0.2.28.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- dekshell-0.2.28.dist-info/entry_points.txt,sha256=d-kbfULiUTZWIBBsrQF3J_-wESncF-4K2rwHT08grlI,75
1
+ dekshell-0.2.30.dist-info/METADATA,sha256=SQKfCIDZhi_4CUb4jUSqT0pP_KsNzRK33k4BjzaJntQ,573
2
+ dekshell-0.2.30.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ dekshell-0.2.30.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=ksoOgBHDRM6uiGHw3ubCk4x7ExJKvJ6H3eGhaM-SNDE,9722
9
+ dekshell/core/contexts/methods.py,sha256=A6t58yBoCEfcQ2rRdmwxwznMpOOGFCUrH8u8RoE2Sow,10375
10
10
  dekshell/core/contexts/properties.py,sha256=esr51c6wDTDsuFXF2uj7WfyIGSq9H0dzqDqWzeMTNQE,2382
11
11
  dekshell/core/markers/__init__.py,sha256=yRQazZ1dxMltFao_RQnDnawSnQcjN_4B930MjJhaZ40,1968
12
12
  dekshell/core/markers/base/__init__.py,sha256=mrOgC5glSG60NMpflSi5mb4bXTmDgv2i-ZYUHCef2Nw,13826
@@ -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.28.dist-info/RECORD,,
40
+ dekshell-0.2.30.dist-info/RECORD,,