Utilize 'Flag' convenience function and migrate from [] to {} as appropriate
This commit is contained in:
parent
f8b077f376
commit
1466438938
3 changed files with 9 additions and 18 deletions
15
clipboard.py
15
clipboard.py
|
@ -14,16 +14,15 @@
|
||||||
|
|
||||||
import pyclip
|
import pyclip
|
||||||
|
|
||||||
from sshare.plugins.config import Argument
|
|
||||||
from sshare.plugins.config import Flag
|
from sshare.plugins.config import Flag
|
||||||
from sshare.plugins.config import NoDefault
|
from sshare.plugins.config import NoDefault
|
||||||
from sshare.plugins.source import Raw
|
from sshare.plugins.source import Raw
|
||||||
|
|
||||||
plugin_type = [ "source", "result" ]
|
plugin_type = { "source", "result" }
|
||||||
|
|
||||||
activate = {
|
activate = {
|
||||||
"source": [ "from_clipboard" ],
|
"source": { "from_clipboard" },
|
||||||
"result": [ "to_clipboard" ],
|
"result": { "to_clipboard" },
|
||||||
}
|
}
|
||||||
config = {
|
config = {
|
||||||
"protocol": "https",
|
"protocol": "https",
|
||||||
|
@ -32,18 +31,14 @@ config = {
|
||||||
"path": "",
|
"path": "",
|
||||||
}
|
}
|
||||||
args = {
|
args = {
|
||||||
"from_clipboard": Argument(
|
"from_clipboard": Flag(
|
||||||
short="p",
|
short="p",
|
||||||
long="paste",
|
long="paste",
|
||||||
action="store_const",
|
|
||||||
const=Flag,
|
|
||||||
help="Upload the contents of the clipboard"
|
help="Upload the contents of the clipboard"
|
||||||
),
|
),
|
||||||
"to_clipboard": Argument(
|
"to_clipboard": Flag(
|
||||||
short="c",
|
short="c",
|
||||||
long="copy",
|
long="copy",
|
||||||
action="store_const",
|
|
||||||
const=Flag,
|
|
||||||
help="Copy the resultant URL to the clipboard"
|
help="Copy the resultant URL to the clipboard"
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ from sshare.plugins.source import File
|
||||||
|
|
||||||
plugin_type = "source"
|
plugin_type = "source"
|
||||||
|
|
||||||
activate = [ "directory" ]
|
activate = { "directory" }
|
||||||
config = {
|
config = {
|
||||||
"directory": NoDefault
|
"directory": NoDefault
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,13 +14,12 @@
|
||||||
|
|
||||||
from desktop_notifier import DesktopNotifierSync, Urgency, Button
|
from desktop_notifier import DesktopNotifierSync, Urgency, Button
|
||||||
|
|
||||||
from sshare.plugins.config import Argument
|
|
||||||
from sshare.plugins.config import Flag
|
from sshare.plugins.config import Flag
|
||||||
from sshare.plugins.config import NoDefault
|
from sshare.plugins.config import NoDefault
|
||||||
|
|
||||||
plugin_type = [ "result" ]
|
plugin_type = "result"
|
||||||
|
|
||||||
activate = [ "activate" ]
|
activate = { "notify" }
|
||||||
config = {
|
config = {
|
||||||
"protocol": "https",
|
"protocol": "https",
|
||||||
"host": NoDefault,
|
"host": NoDefault,
|
||||||
|
@ -28,11 +27,8 @@ config = {
|
||||||
"path": "",
|
"path": "",
|
||||||
}
|
}
|
||||||
args = {
|
args = {
|
||||||
"activate": Argument(
|
"notify": Flag(
|
||||||
short="n",
|
short="n",
|
||||||
long="notify",
|
|
||||||
action="store_const",
|
|
||||||
const=Flag,
|
|
||||||
help="Send a desktop notification"
|
help="Send a desktop notification"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue