summaryrefslogtreecommitdiffstats
path: root/fb.in
diff options
context:
space:
mode:
authorJoakim Reinert <mail@jreinert.com>2013-07-28 13:36:36 +0200
committerFlorian Pritz <bluewind@xinu.at>2013-07-28 13:42:43 +0200
commit0acf745e9aa6ab351fdc4d4c59d3421ea244f17a (patch)
tree5765e0d4e0651fa8aa4b09995b67db3939944832 /fb.in
parentb9445bb6dfbc8cbdabcfe88a6fc55e5855cd95ac (diff)
Added file name option for stdin pastes (-n <file name>)v1.1.4
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'fb.in')
-rw-r--r--fb.in10
1 files changed, 7 insertions, 3 deletions
diff --git a/fb.in b/fb.in
index aa52c99..3ab25db 100644
--- a/fb.in
+++ b/fb.in
@@ -40,6 +40,7 @@ fi
version="@VERSION@"
delete=
extension=""
+filename="stdin"
get=
tar=
compress=0
@@ -228,6 +229,8 @@ usage: [cat |] `basename "$0"` [switches] [options] [<file(s)|ID(s)|folder(s)>]
Options:
-e <extension> extension for default highlighting (e.g. "diff")
+ -n <file name> file name to use for upload when reading from stdin
+ Defaults to "stdin"
-t upload a tar file containing all files (and directories)
-c compress the file being uploaded with gz or xz if used 2 times
When used in conjunction with -g this decompresses the download
@@ -240,9 +243,10 @@ if ! type getopts >/dev/null 2>&1; then
exit 1
fi
-while getopts "e:gdhHtcvD" option; do
+while getopts "e:n:gdhHtcvD" option; do
case $option in
e) extension="$OPTARG";;
+ n) filename="$OPTARG";;
g) get=1;;
c) compress=`expr $compress + 1`;;
t) tar=1;;
@@ -293,8 +297,8 @@ elif [ $# -eq 0 ]; then
printf "%s\n" "Error: -t is not supported when operating on stdin" >&2
exit 1
fi
- read_stdin "$tmpdir/stdin"
- do_upload "$tmpdir/stdin" || exitcode=1
+ read_stdin "$tmpdir/$filename"
+ do_upload "$tmpdir/$filename" || exitcode=1
else
if [ "$tar" ]; then
have_url=