continuing refactor
This commit is contained in:
+7
-7
@@ -290,7 +290,7 @@ def _matches_target(
|
||||
item: Any,
|
||||
target_hash: Optional[str],
|
||||
target_path: Optional[str],
|
||||
target_store: Optional[str] = None,
|
||||
target_instance: Optional[str] = None,
|
||||
) -> bool:
|
||||
"""Determine whether a result item refers to the given target.
|
||||
|
||||
@@ -357,7 +357,7 @@ def _update_item_title_fields(item: Any, new_title: str) -> None:
|
||||
def _refresh_result_table_title(
|
||||
new_title: str,
|
||||
target_hash: Optional[str],
|
||||
target_store: Optional[str],
|
||||
target_instance: Optional[str],
|
||||
target_path: Optional[str],
|
||||
) -> None:
|
||||
"""Refresh the cached result table with an updated title and redisplay it."""
|
||||
@@ -470,7 +470,7 @@ class Add_Tag(Cmdlet):
|
||||
name="add-tag",
|
||||
summary="Add tag to a file in a store.",
|
||||
usage=
|
||||
'add-tag -store <store> [-query "hash:<sha256>"] [-duplicate <format>] [-list <list>[,<list>...]] [--all] <tag>[,<tag>...]',
|
||||
'add-tag -instance <store> [-query "hash:<sha256>"] [-duplicate <format>] [-list <list>[,<list>...]] [--all] <tag>[,<tag>...]',
|
||||
arg=[
|
||||
CmdletArg(
|
||||
"tag",
|
||||
@@ -481,7 +481,7 @@ class Add_Tag(Cmdlet):
|
||||
variadic=True,
|
||||
),
|
||||
SharedArgs.QUERY,
|
||||
SharedArgs.STORE,
|
||||
SharedArgs.INSTANCE,
|
||||
CmdletArg(
|
||||
"-extract",
|
||||
type="string",
|
||||
@@ -515,7 +515,7 @@ class Add_Tag(Cmdlet):
|
||||
],
|
||||
detail=[
|
||||
"- By default, only tag non-temporary files (from pipelines). Use --all to tag everything.",
|
||||
"- Requires a store backend: use -store or pipe items that include store.",
|
||||
"- Requires a store backend: use -instance or pipe items that include store.",
|
||||
"- If -query is not provided, uses the piped item's hash (or derives from its path when possible).",
|
||||
"- Multiple tag can be comma-separated or space-separated.",
|
||||
"- Use -list to include predefined tag lists from adjective.json: -list philosophy,occult",
|
||||
@@ -565,7 +565,7 @@ class Add_Tag(Cmdlet):
|
||||
# If add-tag is in the middle of a pipeline (has downstream stages), default to
|
||||
# including temp files. This enables common flows like:
|
||||
# @N | download-file | add-tag ... | add-file ...
|
||||
store_override = parsed.get("store")
|
||||
store_override = parsed.get("instance")
|
||||
stage_ctx = ctx.get_stage_context()
|
||||
is_last_stage = (stage_ctx is None) or bool(
|
||||
getattr(stage_ctx, "is_last_stage", False)
|
||||
@@ -587,7 +587,7 @@ class Add_Tag(Cmdlet):
|
||||
if not include_temp:
|
||||
results = filter_results_by_temp(results, include_temp=False)
|
||||
|
||||
# When no pipeline payload is present but -query/-store pinpoints a hash, tag it directly.
|
||||
# When no pipeline payload is present but -query/-instance pinpoints a hash, tag it directly.
|
||||
if not results and hash_override and store_override:
|
||||
results = [{"hash": hash_override, "store": store_override}]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user