summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenato Alves <alves.rjc@gmail.com>2016-03-06 04:23:32 +0100
committerBo Ørsted Andresen <zlin@exherbo.org>2016-03-08 12:55:47 +0000
commit5127824a7f38720629952c64bafa4516cd351f65 (patch)
tree0c4123dde4226bc62be711816b95c6457d913f9e
parentff892afd4b9df3a7e3cd69e59361524e1f5dca8d (diff)
downloadwgetpaste-5127824a7f38720629952c64bafa4516cd351f65.tar.gz
Default to secret gists by setting PUBLIC_gists=false
-rwxr-xr-xwgetpaste8
1 files changed, 7 insertions, 1 deletions
diff --git a/wgetpaste b/wgetpaste
index a754ebe..a88da45 100755
--- a/wgetpaste
+++ b/wgetpaste
@@ -85,7 +85,7 @@ escape_input_gists() { sed -e 's|\\|\\\\|g' -e 's|\x1b|\\u001b|g' -e 's|\r||g' -
json_gists() {
local description="${1}" language="${2}" content="${3}"
[[ "$language" = auto ]] && language="" || language=".$language"
- echo "{\"description\":\"${description}\",\"public\":\"true\",\"files\":{\"${description//\/}${language}\":{\"content\":\"${content}\"}}"
+ echo "{\"description\":\"${description}\",\"public\":\"${PUBLIC_gists}\",\"files\":{\"${description//\/}${language}\":{\"content\":\"${content}\"}}"
}
# lodgeit
LANGUAGES_lodgeit="ABAP ActionScript ActionScript%3 Ada ANTLR ANTLR%With%ActionScript%Target \
@@ -352,6 +352,9 @@ per user in any of ~/.wgetpaste.conf or ~/.wgetpaste.d/*.conf.
An additional http header can be passed by setting HEADER_\${SERVICE} in any of the
configuration files mentioned above. For example, authenticating with github gist:
HEADER_gists="Authorization: token 1234abc56789..."
+
+In the case of github gist you can also set PUBLIC_gists='false' if you want to
+default to secret instead of public gists.
EOF
}
@@ -671,6 +674,9 @@ NICK=${NICK:-$(escape "${DEFAULT_NICK}")}
[[ -z $SOURCE ]] && SOURCE="stdin"
CVT_TABS=No
+PUBLIC_gists=${PUBLIC_gists:-true}
+[[ "${PUBLIC_gists}" = "true" || "${PUBLIC_gists}" = "false" ]] || die "Invalid setting for PUBLIC_gists. Can either be 'true' or 'false' not '${PUBLIC_gists}'"
+
INFO_COMMAND=${INFO_COMMAND:-"emerge --info"}
INFO_ARGS=${INFO_ARGS:-"--ignore-default-opts"}