summaryrefslogtreecommitdiff
path: root/publish
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2012-03-10 13:28:27 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2012-03-10 13:28:27 +0000
commitada941728ee4b2cc602fabfac421e5c40cc7105e (patch)
treed8a8b926b409a8d12c179ace73fde2aa09a8b36f /publish
parentb783ab1ade3ebe44de6c34ee7083c9d3a8ff545e (diff)
Allow naming of stdin
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@499 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'publish')
-rwxr-xr-xpublish15
1 files changed, 13 insertions, 2 deletions
diff --git a/publish b/publish
index e40ae33..b1d61d3 100755
--- a/publish
+++ b/publish
@@ -100,7 +100,7 @@ NODO=""
inputxclip=0
do_screenshot=0
-while getopts "hnHSx" OPTION
+while getopts "hnHSxs:" OPTION
do
case $OPTION in
h)
@@ -125,6 +125,9 @@ do
S)
do_screenshot=1
;;
+ s)
+ name_stdin="$OPTARG"
+ ;;
*)
usage >&2
exit 1
@@ -162,7 +165,15 @@ if [[ "$#" = 0 ]]; then
exit 1
fi
fi
- set dummy "$stdin"
+ if [ "${name_stdin%-}" != "" ]; then
+ tmpdir=`mktemp -d`
+ target="$tmpdir/$(basename "$name_stdin")"
+ mv "$stdin" "$target"
+ trap "rm -f '$target' && rmdir '$tmpdir'" EXIT
+ set dummy "$target"
+ else
+ set dummy "$stdin"
+ fi
shift
elif [ "$inputxclip" = 1 ] ; then
echo "Ignoring -x because there are files on the command line" >&2