This commit is contained in:
2026-02-07 14:58:13 -08:00
parent c8230cbb42
commit 60c2cc062c
9 changed files with 69 additions and 78 deletions

View File

@@ -340,7 +340,6 @@ class SharedArgs:
# Path/File arguments
PATH = CmdletArg("path", type="string", description="File or directory path.")
OUTPUT = CmdletArg("output", type="string", description="Output file path.")
# Generic arguments
QUERY = CmdletArg(
@@ -782,7 +781,7 @@ def resolve_target_dir(
*,
handle_creations: bool = True
) -> Optional[Path]:
"""Resolve a target directory from -path, -output, -storage, or config fallback.
"""Resolve a target directory from -path, -storage, or config fallback.
Args:
parsed: Parsed cmdlet arguments dict.
@@ -792,8 +791,8 @@ def resolve_target_dir(
Returns:
Path to the resolved directory, or None if invalid.
"""
# Priority 1: Explicit -path or -output
target = parsed.get("path") or parsed.get("output")
# Priority 1: Explicit -path
target = parsed.get("path")
if target:
try:
p = Path(str(target)).expanduser().resolve()

View File

@@ -72,13 +72,6 @@ class Download_File(Cmdlet):
SharedArgs.PROVIDER,
SharedArgs.PATH,
SharedArgs.QUERY,
# Prefer -path for output directory to match other cmdlets; keep -output for backwards compatibility.
CmdletArg(
name="-output",
type="string",
alias="o",
description="(deprecated) Output directory (use -path instead)",
),
QueryArg(
"clip",
key="clip",
@@ -2782,7 +2775,7 @@ class Download_File(Cmdlet):
# UX: In piped mode, allow a single positional arg to be the destination directory.
# Example: @1-4 | download-file "C:\\Users\\Me\\Downloads\\yoyo"
if (had_piped_input and raw_url and len(raw_url) == 1
and (not parsed.get("path")) and (not parsed.get("output"))):
and (not parsed.get("path"))):
candidate = str(raw_url[0] or "").strip()
low = candidate.lower()
looks_like_url = low.startswith((

View File

@@ -971,8 +971,18 @@ class search_file(Cmdlet):
p_str = str(p_val or "").strip()
if p_str:
if p_str.startswith(("http://", "https://", "magnet:", "torrent:")):
sel_args = ["-url", p_str]
sel_action = ["download-file", "-url", p_str]
h = normalized.get("hash") or normalized.get("file_hash") or normalized.get("hash_hex")
s_val = normalized.get("store")
if h and s_val and "/view_file" in p_str:
try:
h_norm = normalize_hash(h)
except Exception:
h_norm = str(h)
sel_args = ["-query", f"hash:{h_norm}", "-store", str(s_val)]
sel_action = ["get-metadata", "-query", f"hash:{h_norm}", "-store", str(s_val)]
else:
sel_args = ["-url", p_str]
sel_action = ["download-file", "-url", p_str]
else:
try:
from SYS.utils import expand_path