dfdkflj
This commit is contained in:
@@ -7,19 +7,19 @@ from . import register
|
||||
import models
|
||||
import pipeline as ctx
|
||||
from helper import hydrus as hydrus_wrapper
|
||||
from ._shared import Cmdlet, CmdletArg, normalize_hash
|
||||
from ._shared import Cmdlet, CmdletArg, normalize_hash, should_show_help
|
||||
from helper.logger import log
|
||||
|
||||
CMDLET = Cmdlet(
|
||||
name="add-note",
|
||||
summary="Add or set a note on a Hydrus file.",
|
||||
usage="add-note [-hash <sha256>] <name> <text>",
|
||||
args=[
|
||||
arg=[
|
||||
CmdletArg("hash", type="string", description="Override the Hydrus file hash (SHA256) to target instead of the selected result."),
|
||||
CmdletArg("name", type="string", required=True, description="The note name/key to set (e.g. 'comment', 'source', etc.)."),
|
||||
CmdletArg("text", type="string", required=True, description="The note text/content to store.", variadic=True),
|
||||
],
|
||||
details=[
|
||||
detail=[
|
||||
"- Notes are stored in the 'my notes' service by default.",
|
||||
],
|
||||
)
|
||||
@@ -28,12 +28,9 @@ CMDLET = Cmdlet(
|
||||
@register(["add-note", "set-note", "add_note"]) # aliases
|
||||
def add(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
|
||||
# Help
|
||||
try:
|
||||
if any(str(a).lower() in {"-?", "/?", "--help", "-h", "help", "--cmdlet"} for a in args):
|
||||
log(json.dumps(CMDLET, ensure_ascii=False, indent=2))
|
||||
return 0
|
||||
except Exception:
|
||||
pass
|
||||
if should_show_help(args):
|
||||
log(json.dumps(CMDLET, ensure_ascii=False, indent=2))
|
||||
return 0
|
||||
|
||||
from ._shared import parse_cmdlet_args
|
||||
parsed = parse_cmdlet_args(args, CMDLET)
|
||||
|
||||
Reference in New Issue
Block a user