Browse Source

Moved transfer.sh alias to script

master
Micah Halter 2 months ago
parent
commit
16525db784
2 changed files with 18 additions and 18 deletions
  1. 18
    0
      scripts/.config/Scripts/transfer
  2. 0
    18
      zsh/.zsh_aliases

+ 18
- 0
scripts/.config/Scripts/transfer View File

@@ -0,0 +1,18 @@
1
+#!/bin/bash
2
+
3
+
4
+if [ $# -eq 0 ]; then
5
+  echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md";
6
+  return 1;
7
+fi
8
+tmpfile=$( mktemp -t transferXXX );
9
+if tty -s; then
10
+  basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
11
+  curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile;
12
+else
13
+  curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ;
14
+fi;
15
+cat $tmpfile;
16
+command -v xclip > /dev/null && cat $tmpfile | xclip -selection clipboard;
17
+command -v qrencode > /dev/null && cat $tmpfile | qrencode -t UTF8i;
18
+rm -f $tmpfile;

+ 0
- 18
zsh/.zsh_aliases View File

@@ -146,24 +146,6 @@ md5check() { md5sum "$1" | grep "$2";}
146 146
 # function to control web sync services
147 147
 websync() { systemctl --user $1 offlineimap-oneshot.timer; systemctl --user $1 vdirsyncer-oneshot.timer }
148 148
 
149
-# transfer.sh
150
-transfer() {
151
-  if [ $# -eq 0 ]; then
152
-    echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md";
153
-    return 1;
154
-  fi
155
-  tmpfile=$( mktemp -t transferXXX );
156
-  if tty -s; then
157
-    basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
158
-    curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile;
159
-  else
160
-    curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ;
161
-  fi;
162
-  cat $tmpfile;
163
-  command -v qrencode && cat $tmpfile | qrencode -t UTF8i;
164
-  rm -f $tmpfile;
165
-}
166
-
167 149
 filetemplate() {
168 150
   template=$1
169 151
   file=$2

Loading…
Cancel
Save