kash-shell 0.3.28__py3-none-any.whl → 0.3.33__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.
Files changed (74) hide show
  1. kash/actions/core/chat.py +1 -0
  2. kash/actions/core/markdownify_html.py +4 -5
  3. kash/actions/core/minify_html.py +4 -5
  4. kash/actions/core/readability.py +1 -4
  5. kash/actions/core/render_as_html.py +10 -7
  6. kash/actions/core/save_sidematter_meta.py +47 -0
  7. kash/actions/core/show_webpage.py +2 -0
  8. kash/actions/core/zip_sidematter.py +47 -0
  9. kash/commands/base/basic_file_commands.py +7 -4
  10. kash/commands/base/diff_commands.py +6 -4
  11. kash/commands/base/files_command.py +31 -30
  12. kash/commands/base/general_commands.py +3 -2
  13. kash/commands/base/logs_commands.py +6 -4
  14. kash/commands/base/reformat_command.py +3 -2
  15. kash/commands/base/search_command.py +4 -3
  16. kash/commands/base/show_command.py +9 -7
  17. kash/commands/help/assistant_commands.py +6 -4
  18. kash/commands/help/help_commands.py +7 -4
  19. kash/commands/workspace/selection_commands.py +18 -16
  20. kash/commands/workspace/workspace_commands.py +39 -26
  21. kash/config/logger.py +1 -1
  22. kash/config/setup.py +2 -27
  23. kash/config/text_styles.py +1 -1
  24. kash/docs/markdown/topics/a1_what_is_kash.md +26 -18
  25. kash/docs/markdown/topics/a2_installation.md +3 -2
  26. kash/exec/action_decorators.py +7 -5
  27. kash/exec/action_exec.py +104 -53
  28. kash/exec/fetch_url_items.py +40 -11
  29. kash/exec/llm_transforms.py +14 -5
  30. kash/exec/preconditions.py +2 -2
  31. kash/exec/resolve_args.py +4 -1
  32. kash/exec/runtime_settings.py +3 -0
  33. kash/file_storage/file_store.py +108 -114
  34. kash/file_storage/item_file_format.py +91 -26
  35. kash/file_storage/item_id_index.py +128 -0
  36. kash/help/help_types.py +1 -1
  37. kash/llm_utils/llms.py +6 -1
  38. kash/local_server/local_server_commands.py +2 -1
  39. kash/mcp/mcp_server_commands.py +3 -2
  40. kash/mcp/mcp_server_routes.py +42 -12
  41. kash/model/actions_model.py +44 -32
  42. kash/model/compound_actions_model.py +4 -3
  43. kash/model/exec_model.py +33 -3
  44. kash/model/items_model.py +150 -60
  45. kash/model/params_model.py +4 -4
  46. kash/shell/output/shell_output.py +1 -2
  47. kash/utils/api_utils/gather_limited.py +2 -0
  48. kash/utils/api_utils/multitask_gather.py +74 -0
  49. kash/utils/common/s3_utils.py +108 -0
  50. kash/utils/common/url.py +16 -4
  51. kash/utils/file_formats/chat_format.py +7 -4
  52. kash/utils/file_utils/file_ext.py +1 -0
  53. kash/utils/file_utils/file_formats.py +4 -2
  54. kash/utils/file_utils/file_formats_model.py +12 -0
  55. kash/utils/text_handling/doc_normalization.py +1 -1
  56. kash/utils/text_handling/markdown_footnotes.py +224 -0
  57. kash/utils/text_handling/markdown_utils.py +532 -41
  58. kash/utils/text_handling/markdownify_utils.py +2 -1
  59. kash/web_content/web_fetch.py +2 -1
  60. kash/web_gen/templates/components/tooltip_scripts.js.jinja +186 -1
  61. kash/web_gen/templates/components/youtube_popover_scripts.js.jinja +223 -0
  62. kash/web_gen/templates/components/youtube_popover_styles.css.jinja +150 -0
  63. kash/web_gen/templates/content_styles.css.jinja +53 -1
  64. kash/web_gen/templates/youtube_webpage.html.jinja +47 -0
  65. kash/web_gen/webpage_render.py +103 -0
  66. kash/workspaces/workspaces.py +0 -5
  67. kash/xonsh_custom/custom_shell.py +4 -3
  68. {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/METADATA +35 -26
  69. {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/RECORD +72 -64
  70. kash/llm_utils/llm_features.py +0 -72
  71. kash/web_gen/simple_webpage.py +0 -55
  72. {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/WHEEL +0 -0
  73. {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/entry_points.txt +0 -0
  74. {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/licenses/LICENSE +0 -0
kash/actions/core/chat.py CHANGED
@@ -28,6 +28,7 @@ log = get_logger(__name__)
28
28
  @kash_action(
29
29
  expected_args=ONE_OR_NO_ARGS,
30
30
  precondition=is_chat,
31
+ output_format=Format.yaml,
31
32
  uses_selection=False,
32
33
  interactive_input=True,
33
34
  cacheable=False,
@@ -5,7 +5,6 @@ from kash.exec import kash_action
5
5
  from kash.exec.preconditions import has_html_body, is_url_resource
6
6
  from kash.exec.runtime_settings import current_runtime_settings
7
7
  from kash.model import Format, Item
8
- from kash.model.items_model import ItemType
9
8
  from kash.utils.text_handling.markdown_utils import first_heading
10
9
  from kash.utils.text_handling.markdownify_utils import markdownify_custom
11
10
  from kash.web_content.file_cache_utils import get_url_html
@@ -14,7 +13,9 @@ from kash.web_content.web_extract_readabilipy import extract_text_readabilipy
14
13
  log = get_logger(__name__)
15
14
 
16
15
 
17
- @kash_action(precondition=is_url_resource | has_html_body, mcp_tool=True)
16
+ @kash_action(
17
+ precondition=is_url_resource | has_html_body, output_format=Format.markdown, mcp_tool=True
18
+ )
18
19
  def markdownify_html(item: Item) -> Item:
19
20
  """
20
21
  Converts raw HTML or the URL of an HTML page to Markdown, fetching with the content
@@ -36,7 +37,5 @@ def markdownify_html(item: Item) -> Item:
36
37
  # Insert a h1 at the top of the document
37
38
  markdown_content = f"# {title}\n\n{markdown_content}"
38
39
 
39
- output_item = item.derived_copy(
40
- type=ItemType.doc, format=Format.markdown, body=markdown_content
41
- )
40
+ output_item = item.derived_copy(format=Format.markdown, body=markdown_content)
42
41
  return output_item
@@ -14,13 +14,12 @@ from kash.workspaces.workspaces import current_ws
14
14
  )
15
15
  def minify_html(item: Item) -> Item:
16
16
  """
17
- Minify an HTML item's content using [html-minifier-terser](https://github.com/terser/html-minifier-terser).
18
-
17
+ Minify an HTML item's content using [tminify](https://github.com/jlevy/tminify).
19
18
  Also supports Tailwind CSS v4 compilation and inlining, if any Tailwind
20
19
  CSS v4 CDN script tags are found.
21
20
 
22
- The terser minification seems a bit slower but more robust than
23
- [minify-html](https://github.com/wilsonzlin/minify-html).
21
+ Tminify uses [html-minifier-terser](https://github.com/terser/html-minifier-terser).
22
+ This is a bit slower but more robust than [minify-html](https://github.com/wilsonzlin/minify-html).
24
23
  """
25
24
  from tminify.main import tminify
26
25
 
@@ -31,7 +30,7 @@ def minify_html(item: Item) -> Item:
31
30
  input_path = ws.base_dir / item.store_path
32
31
 
33
32
  output_item = item.derived_copy(format=Format.html, body=None)
34
- output_path = ws.target_path_for(output_item)
33
+ output_path = ws.assign_store_path(output_item)
35
34
 
36
35
  tminify(input_path, output_path)
37
36
 
@@ -9,10 +9,7 @@ from kash.web_content.web_extract_readabilipy import extract_text_readabilipy
9
9
  log = get_logger(__name__)
10
10
 
11
11
 
12
- @kash_action(
13
- precondition=is_url_resource | has_html_body,
14
- mcp_tool=True,
15
- )
12
+ @kash_action(precondition=is_url_resource | has_html_body, output_format=Format.html)
16
13
  def readability(item: Item) -> Item:
17
14
  """
18
15
  Extracts clean HTML from a raw HTML item.
@@ -1,17 +1,21 @@
1
1
  from kash.actions.core.tabbed_webpage_config import tabbed_webpage_config
2
2
  from kash.actions.core.tabbed_webpage_generate import tabbed_webpage_generate
3
+ from kash.config.logger import get_logger
3
4
  from kash.exec import kash_action
4
5
  from kash.exec.preconditions import has_fullpage_html_body, has_html_body, has_simple_text_body
5
6
  from kash.exec_model.args_model import ONE_OR_MORE_ARGS
6
7
  from kash.model import ActionInput, ActionResult, Param
7
8
  from kash.model.items_model import ItemType
8
9
  from kash.utils.file_utils.file_formats_model import Format
9
- from kash.web_gen.simple_webpage import simple_webpage_render
10
+ from kash.web_gen.webpage_render import render_item_as_html
11
+
12
+ log = get_logger(__name__)
10
13
 
11
14
 
12
15
  @kash_action(
13
16
  expected_args=ONE_OR_MORE_ARGS,
14
17
  precondition=(has_html_body | has_simple_text_body) & ~has_fullpage_html_body,
18
+ output_format=Format.html,
15
19
  params=(Param("no_title", "Don't add a title to the page body.", type=bool),),
16
20
  )
17
21
  def render_as_html(input: ActionInput, no_title: bool = False) -> ActionResult:
@@ -27,12 +31,11 @@ def render_as_html(input: ActionInput, no_title: bool = False) -> ActionResult:
27
31
  """
28
32
  if len(input.items) == 1:
29
33
  input_item = input.items[0]
30
- html_body = simple_webpage_render(
31
- input_item, add_title_h1=not no_title, show_theme_toggle=True
32
- )
33
- result_item = input_item.derived_copy(
34
- type=ItemType.export, format=Format.html, body=html_body
35
- )
34
+
35
+ result_item = input_item.derived_copy(type=ItemType.export, format=Format.html)
36
+
37
+ result_item = render_item_as_html(input_item, result_item, add_title_h1=not no_title)
38
+
36
39
  return ActionResult([result_item])
37
40
  else:
38
41
  config_result = tabbed_webpage_config(input)
@@ -0,0 +1,47 @@
1
+ from prettyfmt import fmt_lines
2
+ from sidematter_format import Sidematter
3
+
4
+ from kash.config.logger import get_logger
5
+ from kash.exec import kash_action
6
+ from kash.exec_model.args_model import ONE_OR_MORE_ARGS
7
+ from kash.model.actions_model import ActionInput, ActionResult
8
+ from kash.workspaces.workspaces import current_ws
9
+
10
+ log = get_logger(__name__)
11
+
12
+
13
+ @kash_action(expected_args=ONE_OR_MORE_ARGS)
14
+ def save_sidematter_meta(input: ActionInput) -> ActionResult:
15
+ """
16
+ Write the item's metadata as a [sidematter format](https://github.com/jlevy/sidematter-format)
17
+ as `.meta.yml` and `.meta.json` files.
18
+
19
+ If additional data items are provided, their data is merged into the primary item's metadata.
20
+ This is useful for link data etc.
21
+ """
22
+ items = input.items
23
+ assert items
24
+
25
+ primary = items[0]
26
+ assert primary.store_path
27
+
28
+ ws = current_ws()
29
+ sm = Sidematter(ws.base_dir / primary.store_path)
30
+
31
+ metadata_dict = primary.metadata()
32
+
33
+ for item in items[1:]:
34
+ assert item.store_path
35
+ metadata_dict = metadata_dict | item.read_as_data()
36
+
37
+ # Write both JSON and YAML sidematter metadata
38
+ sm.write_meta(metadata_dict, formats="all", make_parents=True)
39
+
40
+ log.message(
41
+ "Wrote sidematter metadata:\n%s",
42
+ fmt_lines(
43
+ [sm.meta_json_path.relative_to(ws.base_dir), sm.meta_yaml_path.relative_to(ws.base_dir)]
44
+ ),
45
+ )
46
+
47
+ return ActionResult(items=[primary])
@@ -6,11 +6,13 @@ from kash.exec_model.args_model import ONE_OR_MORE_ARGS
6
6
  from kash.exec_model.commands_model import Command
7
7
  from kash.exec_model.shell_model import ShellResult
8
8
  from kash.model import ActionInput, ActionResult
9
+ from kash.utils.file_utils.file_formats_model import Format
9
10
 
10
11
 
11
12
  @kash_action(
12
13
  expected_args=ONE_OR_MORE_ARGS,
13
14
  precondition=(has_html_body | has_simple_text_body) & ~has_fullpage_html_body,
15
+ output_format=Format.html,
14
16
  )
15
17
  def show_webpage(input: ActionInput) -> ActionResult:
16
18
  """
@@ -0,0 +1,47 @@
1
+ import zipfile
2
+
3
+ from sidematter_format import Sidematter
4
+
5
+ from kash.config.logger import get_logger
6
+ from kash.exec import kash_action
7
+ from kash.model.items_model import Item, ItemType
8
+ from kash.utils.file_utils.file_formats_model import Format
9
+ from kash.workspaces.workspaces import current_ws
10
+
11
+ log = get_logger(__name__)
12
+
13
+
14
+ @kash_action()
15
+ def zip_sidematter(item: Item) -> Item:
16
+ """
17
+ Zip all contents of the item, its sidematter metadata and items.
18
+ """
19
+ assert item.store_path
20
+ ws = current_ws()
21
+ sm = Sidematter(ws.base_dir / item.store_path)
22
+
23
+ base_dir = sm.primary.parent
24
+
25
+ # Collect all files to include; store paths relative to the primary's directory
26
+ files_to_zip: list[tuple] = []
27
+
28
+ files_to_zip.append((sm.primary, sm.primary.relative_to(base_dir)))
29
+ if sm.meta_json_path.exists():
30
+ files_to_zip.append((sm.meta_json_path, sm.meta_json_path.relative_to(base_dir)))
31
+ if sm.meta_yaml_path.exists():
32
+ files_to_zip.append((sm.meta_yaml_path, sm.meta_yaml_path.relative_to(base_dir)))
33
+ if sm.assets_dir.exists():
34
+ for p in sm.assets_dir.rglob("*"):
35
+ if p.is_file():
36
+ files_to_zip.append((p, p.relative_to(base_dir)))
37
+
38
+ output_item = item.derived_copy(type=ItemType.export, format=Format.zip)
39
+ target = ws.assign_store_path(output_item)
40
+
41
+ with zipfile.ZipFile(
42
+ target, mode="w", compression=zipfile.ZIP_DEFLATED, compresslevel=9
43
+ ) as zipf:
44
+ for path, arcname in files_to_zip:
45
+ zipf.write(path, arcname)
46
+
47
+ return output_item
@@ -33,7 +33,8 @@ def clipboard_copy(path: str | None = None, raw: bool = False) -> None:
33
33
  Copy the contents of a file (or the first file in the selection) to the OS-native
34
34
  clipboard. Similar to `pbcopy` on macOS.
35
35
 
36
- :param raw: Copy the full exact contents of the file. Otherwise frontmatter is omitted.
36
+ Args:
37
+ raw: Copy the full exact contents of the file. Otherwise frontmatter is omitted.
37
38
  """
38
39
  # TODO: Get this to work for images!
39
40
  import pyperclip
@@ -95,7 +96,8 @@ def edit(path: str | None = None, all: bool = False) -> None:
95
96
  """
96
97
  Edit the contents of a file using the user's default editor (or defaulting to nano).
97
98
 
98
- :param all: Normally edits only the first file given. This passes all files to the editor.
99
+ Args:
100
+ all: Normally edits only the first file given. This passes all files to the editor.
99
101
  """
100
102
  input_paths = assemble_path_args(path)
101
103
  if not all:
@@ -111,8 +113,9 @@ def file_info(*paths: str, size_summary: bool = False, format: bool = False) ->
111
113
  structure of the items at the given paths (for text documents) and the detected
112
114
  mime type.
113
115
 
114
- :param size_summary: Only show size summary (words, sentences, paragraphs for a text document).
115
- :param format: Only show detected file format.
116
+ Args:
117
+ size_summary: Only show size summary (words, sentences, paragraphs for a text document).
118
+ format: Only show detected file format.
116
119
  """
117
120
  if not size_summary and not format:
118
121
  size_summary = format = True
@@ -57,8 +57,9 @@ def diff_items(*paths: str, force: bool = False) -> ShellResult:
57
57
  as items themselves, so this works on items. Items are imported as usual into the
58
58
  global workspace if they are not already in the store.
59
59
 
60
- :param stat: Only show the diffstat summary.
61
- :param force: If true, will run the diff even if the items are of different formats.
60
+ Args:
61
+ stat: Only show the diffstat summary.
62
+ force: If true, will run the diff even if the items are of different formats.
62
63
  """
63
64
  ws = current_ws()
64
65
  if len(paths) == 2:
@@ -90,8 +91,9 @@ def diff_files(*paths: str, diffstat: bool = False, save: bool = False) -> Shell
90
91
  Show the unified diff between the given files. This works on any files, not
91
92
  just items, so helpful for quick analysis without importing the files.
92
93
 
93
- :param diffstat: Only show the diffstat summary.
94
- :param save: Save the diff as an item in the store.
94
+ Args:
95
+ diffstat: Only show the diffstat summary.
96
+ save: Save the diff as an item in the store.
95
97
  """
96
98
  if len(paths) == 2:
97
99
  [path1, path2] = paths
@@ -111,36 +111,37 @@ def files(
111
111
  with limited depth and breadth, and more control over recursion, sorting,
112
112
  and grouping.
113
113
 
114
- :param overview: Recurse a couple levels and show files, but not too many.
115
- Same as `--groupby=parent --depth=2 --max_per_group=100 --omit_dirs`
116
- except also scales down `max_per_group` to 25 or 50 if there are many files.
117
- :param recent: Only shows the most recently modified files in each directory.
118
- Same as `--sort=modified --reverse --groupby=parent --max_per_group=100`
119
- except also scales down `max_per_group` to 25 or 50 if there are many files.
120
- :param recursive: List all files recursively. Same as `--depth=-1`.
121
- :param flat: Show files in a flat list, rather than grouped by parent directory.
122
- Same as `--groupby=flat`.
123
- :param omit_dirs: Normally directories are included. This option omits them,
124
- which is useful when recursing into subdirectories.
125
- :param depth: Maximum depth to recurse into directories. -1 means no limit.
126
- :param max_files: Maximum number of files to yield per input path.
127
- -1 means no limit.
128
- :param max_per_subdir: Maximum number of files to yield per subdirectory
129
- (not including the top level). -1 means no limit.
130
- :param max_per_group: Limit the first number of items displayed per group
131
- (if groupby is used) or in total. 0 means show all.
132
- :param no_max: Disable limits on depth and number of files. Same as
133
- `--depth=-1 --max_files=-1 --max_per_subdir=-1 --max_per_group=-1`.
134
- :param no_ignore: Disable ignoring hidden files.
135
- :param all: Same as `--no_ignore --no_max`. Does not change `--depth`.
136
- :param save: Save the listing as a CSV file item.
137
- :param sort: Sort by `filename`, `size`, `accessed`, `created`, or `modified`.
138
- :param reverse: Reverse the sorting order.
139
- :param since: Filter files modified since a given time (e.g., '1 day', '2 hours').
140
- :param groupby: Group results. Can be `flat` (no grouping, and by default implies
141
- recursive), `parent`, or `suffix`. Defaults to 'parent'.
142
- :param iso_time: Show time in ISO format (default is human-readable age).
143
- :param pager: Use the pager when displaying the output.
114
+ Args:
115
+ overview: Recurse a couple levels and show files, but not too many.
116
+ Same as `--groupby=parent --depth=2 --max_per_group=100 --omit_dirs`
117
+ except also scales down `max_per_group` to 25 or 50 if there are many files.
118
+ recent: Only shows the most recently modified files in each directory.
119
+ Same as `--sort=modified --reverse --groupby=parent --max_per_group=100`
120
+ except also scales down `max_per_group` to 25 or 50 if there are many files.
121
+ recursive: List all files recursively. Same as `--depth=-1`.
122
+ flat: Show files in a flat list, rather than grouped by parent directory.
123
+ Same as `--groupby=flat`.
124
+ omit_dirs: Normally directories are included. This option omits them,
125
+ which is useful when recursing into subdirectories.
126
+ depth: Maximum depth to recurse into directories. -1 means no limit.
127
+ max_files: Maximum number of files to yield per input path.
128
+ -1 means no limit.
129
+ max_per_subdir: Maximum number of files to yield per subdirectory
130
+ (not including the top level). -1 means no limit.
131
+ max_per_group: Limit the first number of items displayed per group
132
+ (if groupby is used) or in total. 0 means show all.
133
+ no_max: Disable limits on depth and number of files. Same as
134
+ `--depth=-1 --max_files=-1 --max_per_subdir=-1 --max_per_group=-1`.
135
+ no_ignore: Disable ignoring hidden files.
136
+ all: Same as `--no_ignore --no_max`. Does not change `--depth`.
137
+ save: Save the listing as a CSV file item.
138
+ sort: Sort by `filename`, `size`, `accessed`, `created`, or `modified`.
139
+ reverse: Reverse the sorting order.
140
+ since: Filter files modified since a given time (e.g., '1 day', '2 hours').
141
+ groupby: Group results. Can be `flat` (no grouping, and by default implies
142
+ recursive), `parent`, or `suffix`. Defaults to 'parent'.
143
+ iso_time: Show time in ISO format (default is human-readable age).
144
+ pager: Use the pager when displaying the output.
144
145
  """
145
146
  if global_settings().use_nerd_icons:
146
147
  from kash.shell.file_icons.nerd_icons import icon_for_file
@@ -160,8 +160,9 @@ def check_system_tools(warn_only: bool = False, brief: bool = False) -> None:
160
160
  """
161
161
  Check that all tools are installed.
162
162
 
163
- :param warn_only: Only warn if tools are missing.
164
- :param brief: Print summary as a single line.
163
+ Args:
164
+ warn_only: Only warn if tools are missing.
165
+ brief: Print summary as a single line.
165
166
  """
166
167
  if warn_only:
167
168
  pkg_check().warn_if_missing()
@@ -23,7 +23,8 @@ def logs(follow: bool = False) -> None:
23
23
  """
24
24
  Page through the logs for the current workspace.
25
25
 
26
- :param follow: Follow the file as it grows.
26
+ Args:
27
+ follow: Follow the file as it grows.
27
28
  """
28
29
  tail_file(get_log_settings().log_file_path, follow=follow)
29
30
 
@@ -51,9 +52,10 @@ def log_level(level: str | None = None, console: bool = False, file: bool = Fals
51
52
  """
52
53
  Set or show the log level. Applies to both console and file log levels unless specified.
53
54
 
54
- :param level: The log level to set. If not specified, will show current level.
55
- :param console: Set console log level only.
56
- :param file: Set file log level only.
55
+ Args:
56
+ level: The log level to set. If not specified, will show current level.
57
+ console: Set console log level only.
58
+ file: Set file log level only.
57
59
  """
58
60
  if not console and not file:
59
61
  console = True
@@ -22,8 +22,9 @@ def reformat(*paths: str, inplace: bool = False) -> ShellResult:
22
22
 
23
23
  TODO: Also handle JSON and YAML.
24
24
 
25
- :param inplace: Overwrite the original file. Otherwise save to a new
26
- file with `_formatted` appended to the original name.
25
+ Args:
26
+ inplace: Overwrite the original file. Otherwise save to a new
27
+ file with `_formatted` appended to the original name.
27
28
  """
28
29
  resolved_paths = assemble_path_args(*paths)
29
30
  final_paths = []
@@ -30,9 +30,10 @@ def search(
30
30
 
31
31
  search "youtube.com" resources/ --sort=modified
32
32
 
33
- :param sort: How to sort results. Can be `path` or `modified` or `created` (as with `rg`).
34
- :param ignore_case: Ignore case when searching.
35
- :param verbose: Also print the ripgrep command line.
33
+ Args:
34
+ sort: How to sort results. Can be `path` or `modified` or `created` (as with `rg`).
35
+ ignore_case: Ignore case when searching.
36
+ verbose: Also print the ripgrep command line.
36
37
  """
37
38
  pkg_check().require("ripgrep")
38
39
  from ripgrepy import RipGrepNotFound, Ripgrepy
@@ -30,12 +30,13 @@ def show(
30
30
  Will use `bat` if available to show files in the console, including syntax
31
31
  highlighting and git diffs.
32
32
 
33
- :param console: Force display to console (not browser or native apps).
34
- :param native: Force display with a native app (depending on your system configuration).
35
- :param thumbnail: If there is a thumbnail image, show it too.
36
- :param browser: Force display with your default web browser.
37
- :param plain: Use plain view in the console (this is `bat`'s `plain` style).
38
- :param noselect: Disable default behavior where `show` also will `select` the file.
33
+ Args:
34
+ console: Force display to console (not browser or native apps).
35
+ native: Force display with a native app (depending on your system configuration).
36
+ thumbnail: If there is a thumbnail image, show it too.
37
+ browser: Force display with your default web browser.
38
+ plain: Use plain view in the console (this is `bat`'s `plain` style).
39
+ noselect: Disable default behavior where `show` also will `select` the file.
39
40
  """
40
41
  view_mode = (
41
42
  ViewMode.console
@@ -69,7 +70,8 @@ def show(
69
70
  if not noselect:
70
71
  from kash.commands.workspace.selection_commands import select
71
72
 
72
- select(input_path)
73
+ if isinstance(input_path, StorePath):
74
+ select(input_path)
73
75
  return ShellResult(show_selection=True)
74
76
  except (InvalidInput, InvalidState):
75
77
  if path:
@@ -31,9 +31,10 @@ def assist(
31
31
  Invoke the kash assistant. You don't normally need this command as it is the same as just
32
32
  asking a question (a question ending with ?) on the kash console.
33
33
 
34
- :param type: The type of assistance to use.
35
- :param model: The model to use for the assistant. If not provided, the default model
36
- for the assistant type is used.
34
+ Args:
35
+ type: The type of assistance to use.
36
+ model: The model to use for the assistant. If not provided, the default model
37
+ for the assistant type is used.
37
38
  """
38
39
  if not input:
39
40
  input = input_simple_string(
@@ -81,7 +82,8 @@ def assistant_history(follow: bool = False) -> None:
81
82
  """
82
83
  Show the assistant history for the current workspace.
83
84
 
84
- :param follow: Follow the file as it grows.
85
+ Args:
86
+ follow: Follow the file as it grows.
85
87
  """
86
88
  ws = current_ws()
87
89
  tail_file(ws.base_dir / ws.dirs.assistant_history_yml, follow=follow)
@@ -37,8 +37,9 @@ def help(query: str | None = None, search: bool = False) -> None:
37
37
  Note that if you want Python `help()` and not kash help, use the
38
38
  alias `pyhelp`.
39
39
 
40
- :param search: If true, does a simple search of help docs
41
- (same as `search_help`).
40
+ Args:
41
+ search: If true, does a simple search of help docs
42
+ (same as `search_help`).
42
43
  """
43
44
  if not search and not query:
44
45
  manual()
@@ -53,7 +54,8 @@ def commands(no_pager: bool = False, full: bool = False) -> None:
53
54
  """
54
55
  Show help on all kash commands.
55
56
 
56
- :param full: If true, show full help for each command.
57
+ Args:
58
+ full: If true, show full help for each command.
57
59
  """
58
60
  from kash.help.help_pages import print_builtin_commands_help
59
61
 
@@ -73,7 +75,8 @@ def actions(no_pager: bool = False, full: bool = False) -> None:
73
75
  """
74
76
  Show help on the full list of currently loaded actions.
75
77
 
76
- :param full: If true, show full help for each action.
78
+ Args:
79
+ full: If true, show full help for each action.
77
80
  """
78
81
  from kash.help.help_pages import print_actions_help
79
82
 
@@ -43,17 +43,18 @@ def select(
43
43
  If any other flags are given, they show or modify the selection history.
44
44
  They must be used individually (and without paths).
45
45
 
46
- :param history: Show the full selection history.
47
- :param last: Show the last `last` selections in the history.
48
- :param back: Move back in the selection history by `back` steps.
49
- :param forward: Move forward in the selection history by `forward` steps.
50
- :param previous: Move back in the selection history to the previous selection.
51
- :param next: Move forward in the selection history to the next selection.
52
- :param pop: Pop the current selection from the history.
53
- :param clear_all: Clear the full selection history.
54
- :param clear_future: Clear all selections from history after the current one.
55
- :param refresh: Refresh the current selection to drop any paths that no longer exist.
56
- :param no_check: Do not check if the paths exist.
46
+ Args:
47
+ history: Show the full selection history.
48
+ last: Show the last `last` selections in the history.
49
+ back: Move back in the selection history by `back` steps.
50
+ forward: Move forward in the selection history by `forward` steps.
51
+ previous: Move back in the selection history to the previous selection.
52
+ next: Move forward in the selection history to the next selection.
53
+ pop: Pop the current selection from the history.
54
+ clear_all: Clear the full selection history.
55
+ clear_future: Clear all selections from history after the current one.
56
+ refresh: Refresh the current selection to drop any paths that no longer exist.
57
+ no_check: Do not check if the paths exist.
57
58
  """
58
59
  ws = current_ws()
59
60
 
@@ -182,11 +183,12 @@ def save(parent: str | None = None, to: str | None = None, no_frontmatter: bool
182
183
  Save the current selection to the given directory, or to the current directory if no
183
184
  target given.
184
185
 
185
- :param parent: The directory to save the files to. If not given, it will be the
186
- current directory.
187
- :param to: If only one file is selected, a name to save it as. If it exists, it will
188
- overwrite (and make a backup).
189
- :param no_frontmatter: If true, will not include YAML frontmatter in the output.
186
+ Args:
187
+ parent: The directory to save the files to. If not given, it will be the
188
+ current directory.
189
+ to: If only one file is selected, a name to save it as. If it exists, it will
190
+ overwrite (and make a backup).
191
+ no_frontmatter: If true, will not include YAML frontmatter in the output.
190
192
  """
191
193
  ws = current_ws()
192
194
  store_paths = ws.selections.current.paths