j
This commit is contained in:
@@ -669,17 +669,34 @@ class Add_Tag(Cmdlet):
|
||||
# treat add-tag as a pipeline mutation (carry tags forward for add-file) instead of a store write.
|
||||
if not store_override:
|
||||
store_name_str = str(store_name) if store_name is not None else ""
|
||||
local_mode_requested = (
|
||||
(not store_name_str) or (store_name_str.upper() == "PATH")
|
||||
or (store_name_str.lower() == "local")
|
||||
)
|
||||
is_known_backend = bool(store_name_str) and store_registry.is_available(
|
||||
store_name_str
|
||||
)
|
||||
|
||||
is_known_backend = False
|
||||
try:
|
||||
is_known_backend = bool(store_name_str) and store_registry.is_available(
|
||||
store_name_str
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if local_mode_requested and raw_path:
|
||||
# If the item isn't in a configured store backend yet (e.g., store=PATH),
|
||||
# treat add-tag as a pipeline mutation (carry tags forward for add-file)
|
||||
# instead of a store write.
|
||||
if not is_known_backend:
|
||||
try:
|
||||
if Path(str(raw_path)).expanduser().exists():
|
||||
# We allow metadata updates even if file doesn't exist locally,
|
||||
# but check path existence if valid path provided.
|
||||
proceed_local = True
|
||||
if raw_path:
|
||||
try:
|
||||
if not Path(str(raw_path)).expanduser().exists():
|
||||
# If path is provided but missing, we might prefer skipping?
|
||||
# But for pipeline metadata, purely missing file shouldn't block tagging.
|
||||
# So we allow it.
|
||||
pass
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if proceed_local:
|
||||
existing_tag_list = _extract_item_tags(res)
|
||||
existing_lower = {
|
||||
t.lower()
|
||||
@@ -799,14 +816,9 @@ class Add_Tag(Cmdlet):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if local_mode_requested:
|
||||
log(
|
||||
"[add_tag] Error: Missing usable local path for tagging (or provide -store)",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return 1
|
||||
|
||||
if store_name_str and not is_known_backend:
|
||||
# If it's not a known backend and we didn't handle it above as a local/pipeline
|
||||
# metadata edit, then it's an error.
|
||||
log(
|
||||
f"[add_tag] Error: Unknown store '{store_name_str}'. Available: {store_registry.list_backends()}",
|
||||
file=sys.stderr,
|
||||
|
||||
Reference in New Issue
Block a user