diff options
Diffstat (limited to 'arch/scripts')
| -rwxr-xr-x | arch/scripts/.local/bin/copythe | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/scripts/.local/bin/copythe b/arch/scripts/.local/bin/copythe new file mode 100755 index 0000000..0ba1cc2 --- /dev/null +++ b/arch/scripts/.local/bin/copythe @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -eo pipefail + +declare -A sources +sources[date]="date" +sources[ip]="ip" + +tocopy="" + +case "$1" in + ${sources[date]} ) + tocopy=$(date --rfc-3339 date) + ;; + ${sources[ip]} ) + tocopy=$(curl --silent ifconfig.me) + ;; + *) + args="" + for val in "${sources[@]}"; do + args+="|${val}" + done + + echo "usage: $0 (${args#|})" + exit + ;; + +esac + +echo "Copying: ${tocopy:0:50}" +wl-copy ${tocopy} |