Commit | Line | Data |
---|---|---|
cc1ae02e | 1 | #!/bin/sh |
0ec2b704 | 2 | set -e -u |
59f0d218 | 3 | |
0ec2b704 FF |
4 | SCRIPTNAME=termux-clipboard-set |
5 | show_usage () { | |
6 | echo "Usage: $SCRIPTNAME <text>" | |
7 | echo "Set the system clipboard text." | |
8 | echo "" | |
9 | echo "If no arguments are given the text to set is read from stdin," | |
10 | echo "otherwise all arguments given are used as the text to set." | |
11 | exit 0 | |
12 | } | |
13 | ||
14 | while getopts :h option | |
15 | do | |
16 | case "$option" in | |
17 | h) show_usage;; | |
18 | ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1; | |
19 | esac | |
20 | done | |
21 | shift $(($OPTIND-1)) | |
22 | ||
23 | CMD="@TERMUX_API@ Clipboard -e api_version 2 --ez set true" | |
9228c434 | 24 | if [ $# = 0 ]; then |
0ec2b704 | 25 | $CMD |
9228c434 | 26 | else |
0ec2b704 | 27 | echo $@ | $CMD |
9228c434 FF |
28 | fi |
29 |