From 1466438938c98442aa6de55065b7e6a06a7e8d50 Mon Sep 17 00:00:00 2001 From: Gnarwhal Date: Sun, 8 Sep 2024 20:10:03 +0000 Subject: [PATCH] Utilize 'Flag' convenience function and migrate from [] to {} as appropriate --- clipboard.py | 15 +++++---------- latest.py | 2 +- notification.py | 10 +++------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/clipboard.py b/clipboard.py index 9766e2d..84638de 100644 --- a/clipboard.py +++ b/clipboard.py @@ -14,16 +14,15 @@ import pyclip -from sshare.plugins.config import Argument from sshare.plugins.config import Flag from sshare.plugins.config import NoDefault from sshare.plugins.source import Raw -plugin_type = [ "source", "result" ] +plugin_type = { "source", "result" } activate = { - "source": [ "from_clipboard" ], - "result": [ "to_clipboard" ], + "source": { "from_clipboard" }, + "result": { "to_clipboard" }, } config = { "protocol": "https", @@ -32,18 +31,14 @@ config = { "path": "", } args = { - "from_clipboard": Argument( + "from_clipboard": Flag( short="p", long="paste", - action="store_const", - const=Flag, help="Upload the contents of the clipboard" ), - "to_clipboard": Argument( + "to_clipboard": Flag( short="c", long="copy", - action="store_const", - const=Flag, help="Copy the resultant URL to the clipboard" ), } diff --git a/latest.py b/latest.py index ccb6c3b..fdebc6d 100644 --- a/latest.py +++ b/latest.py @@ -22,7 +22,7 @@ from sshare.plugins.source import File plugin_type = "source" -activate = [ "directory" ] +activate = { "directory" } config = { "directory": NoDefault } diff --git a/notification.py b/notification.py index a2d46a1..772bdbd 100644 --- a/notification.py +++ b/notification.py @@ -14,13 +14,12 @@ from desktop_notifier import DesktopNotifierSync, Urgency, Button -from sshare.plugins.config import Argument from sshare.plugins.config import Flag from sshare.plugins.config import NoDefault -plugin_type = [ "result" ] +plugin_type = "result" -activate = [ "activate" ] +activate = { "notify" } config = { "protocol": "https", "host": NoDefault, @@ -28,11 +27,8 @@ config = { "path": "", } args = { - "activate": Argument( + "notify": Flag( short="n", - long="notify", - action="store_const", - const=Flag, help="Send a desktop notification" ) }