Add ability to specify type for clipboard contents
This commit is contained in:
parent
d922b30b5a
commit
0cbb81abdf
1 changed files with 8 additions and 4 deletions
12
clipboard.py
12
clipboard.py
|
@ -14,6 +14,7 @@
|
|||
|
||||
import pyclip
|
||||
|
||||
from sshare.plugin.config import Argument
|
||||
from sshare.plugin.config import Flag
|
||||
from sshare.plugin.config import NoDefault
|
||||
from sshare.plugin.source import Raw
|
||||
|
@ -21,13 +22,16 @@ from sshare.plugin.source import Raw
|
|||
plugin_type = { "source", "feedback" }
|
||||
|
||||
activate = {
|
||||
"source": { "from_clipboard" },
|
||||
"source": { "type" },
|
||||
"feedback": { "to_clipboard" },
|
||||
}
|
||||
args = {
|
||||
"from_clipboard": Flag(
|
||||
"type": Argument(
|
||||
name="paste",
|
||||
help="Upload the contents of the clipboard"
|
||||
nargs="?",
|
||||
const=Flag,
|
||||
default="txt",
|
||||
help="Upload the contents of the clipboard as text"
|
||||
),
|
||||
"to_clipboard": Flag(
|
||||
name="copy",
|
||||
|
@ -37,7 +41,7 @@ args = {
|
|||
|
||||
def get_source():
|
||||
logger.info("Uploading contents of clipboard")
|
||||
return Raw("txt", pyclip.paste())
|
||||
return Raw(config.type, pyclip.paste())
|
||||
|
||||
def give_feedback(location):
|
||||
pyclip.copy(location)
|
||||
|
|
Loading…
Reference in a new issue