termux-api: Change termux-clipboard-set

Make termux-clipboard-set set the clipboard to the arguments if
given, and only take stdin as input if no arguments given.

Closes https://github.com/termux/termux-api/issues/8
This commit is contained in:
Fredrik Fornwall 2015-12-29 18:13:30 -05:00
parent ee3660535a
commit 9228c43493
2 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,6 @@
TERMUX_PKG_HOMEPAGE=http://termux.com/add-ons/api/ TERMUX_PKG_HOMEPAGE=http://termux.com/add-ons/api/
TERMUX_PKG_DESCRIPTION="Termux API commands" TERMUX_PKG_DESCRIPTION="Termux API commands"
TERMUX_PKG_VERSION=0.9 TERMUX_PKG_VERSION=0.10
termux_step_make_install () { termux_step_make_install () {
mkdir -p $TERMUX_PREFIX/bin mkdir -p $TERMUX_PREFIX/bin

View File

@ -1,4 +1,9 @@
#!/bin/sh #!/bin/sh
TEXT=`cat -` if [ $# = 0 ]; then
TEXT=`cat -`
else
TEXT="$@"
fi
@TERMUX_API@ Clipboard --es text "$TEXT" @TERMUX_API@ Clipboard --es text "$TEXT"