From 0acf745e9aa6ab351fdc4d4c59d3421ea244f17a Mon Sep 17 00:00:00 2001 From: Joakim Reinert Date: Sun, 28 Jul 2013 13:36:36 +0200 Subject: Added file name option for stdin pastes (-n ) Signed-off-by: Florian Pritz --- fb.1 | 3 +++ fb.in | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fb.1 b/fb.1 index cda5e16..26077d5 100644 --- a/fb.1 +++ b/fb.1 @@ -69,6 +69,9 @@ will try to extract the ID. Change the extension used for highlighting. You can also do this if you have already uploaded the file by appending the extension to the URL. http://paste.xinu.at//bash will change the syntax highlighting to bash. +.It Fl n Ar file name +Use the specified file name for the upload when pasting from stdin. Defaults +to "stdin" .It Fl g Download the IDs and output on stdout. Please take care when using this, as binary data may cause unexpected results when being output directly to a 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] [] Options: -e extension for default highlighting (e.g. "diff") + -n 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= -- cgit v1.2.3-24-g4f1b