changeset 48:fa7125489435

paster: make private pastes by default, closes #2481
author David Demelier <markand@malikania.fr>
date Fri, 14 Feb 2020 20:10:00 +0100
parents ad092d8050d2
children d8e22b0c0237
files CHANGES.md paster.1.in paster.sh
diffstat 3 files changed, 20 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.md	Fri Feb 14 15:01:26 2020 +0100
+++ b/CHANGES.md	Fri Feb 14 20:10:00 2020 +0100
@@ -1,6 +1,11 @@
 paster CHANGES
 ==============
 
+paster -- current
+-----------------------
+
+- Pastes are private by default with paster(1) (#2481).
+
 paster 0.2.1 2020-02-14
 -----------------------
 
--- a/paster.1.in	Fri Feb 14 15:01:26 2020 +0100
+++ b/paster.1.in	Fri Feb 14 20:10:00 2020 +0100
@@ -23,7 +23,7 @@
 .\" SYNOPSIS
 .Sh SYNOPSIS
 .Nm
-.Op Fl LDvx
+.Op Fl LDpv
 .Op Fl a Ar author
 .Op Fl l Ar language
 .Op Fl d Ar duration
@@ -56,10 +56,10 @@
 List all supported languages.
 .It Fl D
 List all supported durations.
+.It Fl p
+Store the paste as public (default is private).
 .It Fl v
 Be more verbose.
-.It Fl x
-Store the paste as private.
 .It Fl a Ar author
 Sets the author, defaults to
 .Dq Anonymous .
@@ -82,9 +82,9 @@
 .Bd -literal -offset
 grep error logs.txt | paster - http://example.org
 .Ed
-.Ss Paste a non-listed file with a short duration.
+.Ss Paste a public file file with a short duration.
 .Bd -literal -offset
-paste -x -d hour private.txt http://example.org
+paster -p -d hour some-data.txt http://example.org
 .Ed
 .\" AUTHORS
 .Sh AUTHORS
--- a/paster.sh	Fri Feb 14 15:01:26 2020 +0100
+++ b/paster.sh	Fri Feb 14 20:10:00 2020 +0100
@@ -20,7 +20,7 @@
 language="nohighlight"
 title="Untitled"
 duration="month"
-private=0
+public=0
 verbose=0
 
 die()
@@ -223,16 +223,19 @@
 usage()
 {
 	cat 1>&2 <<-EOF
-	usage: paster [-LDvx] [-a author] [-l language] [-d duration] [-t title] filename host
+	usage: paster [-LDpv] [-a author] [-l language] [-d duration] [-t title] filename host
 	EOF
 	exit 1
 }
 
 send()
 {
-	if [ $private -eq 1 ]; then
+	if [ $public -eq 1 ]; then
+		with_private="--data private=off"
+	else
 		with_private="--data private=on"
 	fi
+
 	if [ $verbose -eq 0 ]; then
 		with_verbose="-s"
 	fi
@@ -252,7 +255,7 @@
 	die "abort: curl is required"
 fi
 
-while getopts "LDa:d:l:t:vx" opt; do
+while getopts "LDa:d:l:pt:v" opt; do
 	case "$opt" in
 	D)
 		durations
@@ -269,15 +272,15 @@
 	l)
 		language="$OPTARG"
 		;;
+	p)
+		public=1
+		;;
 	t)
 		title="$OPTARG"
 		;;
 	v)
 		verbose=1
 		;;
-	x)
-		private=1
-		;;
 	*)
 		usage
 		;;