chiark / gitweb /
vim: Use sensible.vim as system vimrc
[termux-packages] / packages / termux-api / termux-clipboard-set
1 #!/bin/sh
2 set -e -u
3
4 SCRIPTNAME=termux-clipboard-set
5 show_usage () {
6     echo "Usage: $SCRIPTNAME [text]"
7     echo "Set the system clipboard text. The text to set is either supplied as arguments or read from stdin if no arguments are given."
8     exit 0
9 }
10
11 while getopts :h option
12 do
13     case "$option" in
14         h) show_usage;;
15         ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
16     esac
17 done
18 shift $(($OPTIND-1))
19
20 CMD="@TERMUX_API@ Clipboard -e api_version 2 --ez set true"
21 if [ $# = 0 ]; then
22         $CMD
23 else
24         echo $@ | $CMD
25 fi
26