From 9228c43493b3bf7c38a69f6a6e3ab1ae72447e11 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Tue, 29 Dec 2015 18:13:30 -0500 Subject: [PATCH] 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 --- packages/termux-api/build.sh | 2 +- packages/termux-api/termux-clipboard-set | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/termux-api/build.sh b/packages/termux-api/build.sh index 7bb6fec84..702e7e3c2 100644 --- a/packages/termux-api/build.sh +++ b/packages/termux-api/build.sh @@ -1,6 +1,6 @@ TERMUX_PKG_HOMEPAGE=http://termux.com/add-ons/api/ TERMUX_PKG_DESCRIPTION="Termux API commands" -TERMUX_PKG_VERSION=0.9 +TERMUX_PKG_VERSION=0.10 termux_step_make_install () { mkdir -p $TERMUX_PREFIX/bin diff --git a/packages/termux-api/termux-clipboard-set b/packages/termux-api/termux-clipboard-set index 076ea0155..fb797ac3b 100755 --- a/packages/termux-api/termux-clipboard-set +++ b/packages/termux-api/termux-clipboard-set @@ -1,4 +1,9 @@ #!/bin/sh -TEXT=`cat -` +if [ $# = 0 ]; then + TEXT=`cat -` +else + TEXT="$@" +fi + @TERMUX_API@ Clipboard --es text "$TEXT"