summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Ørsted Andresen <bo.andresen@zlin.dk>2007-03-06 13:10:26 +0000
committerBo Ørsted Andresen <bo.andresen@zlin.dk>2007-03-06 13:10:26 +0000
commitf4591f723d4e33ba532cbf37657960da43f53673 (patch)
treea5a8e5b18cb0b9d50869dfb52abe5ffce09605d8
parent8b1feed4ab571370ebc24964c6fc2f7e8240af66 (diff)
downloadwgetpaste-f4591f723d4e33ba532cbf37657960da43f53673.tar.gz
Make it possible to set default nick and language on a per service basis too.
-rwxr-xr-xwgetpaste8
1 files changed, 5 insertions, 3 deletions
diff --git a/wgetpaste b/wgetpaste
index 75b4ee7..41e458e 100755
--- a/wgetpaste
+++ b/wgetpaste
@@ -65,8 +65,8 @@ DEFAULT_NICK="${DEFAULT_NICK:-$(whoami)}"
DEFAULT_SERVICE="${DEFAULT_SERVICE:-rafb}"
DEFAULT_LANGUAGE="${DEFAULT_LANGUAGE:-Plain Text}"
DEFAULT_EXPIRATION="${DEFAULT_EXPIRATION:-1 month}"
-# setting DEFAULT_EXPIRATION_${SERVICE} can be used to override for services where the general
-# default is unavailable.
+# setting e.g. DEFAULT_EXPIRATION_${SERVICE} can be used to override the default setting for
+# just one service
### usage
@@ -96,7 +96,7 @@ show_usage() {
echo " -h, --help show this help"
echo " --version show version information"
echo
- echo "Defaults (DEFAULT_{NICK,SERVICE,LANGUAGE,EXPIRATION,EXPIRATION_\${SERVICE}}) can be"
+ echo "Defaults (DEFAULT_{NICK,SERVICE,LANGUAGE,EXPIRATION}[_\${SERVICE}]) can be"
echo "overridden globally in /etc/wgetpaste or per user in ~/.wgetpaste."
}
@@ -500,6 +500,7 @@ done
# set default service, nick, source and tabs convertion
SERVICE="${SERVICE:-${DEFAULT_SERVICE}}"
+[[ -n "$(eval "echo \${DEFAULT_NICK_${SERVICE}}")" ]] && NICK="${NICK:-$(eval "echo \${DEFAULT_NICK_${SERVICE}}")}"
NICK="${NICK:-$(escape "${DEFAULT_NICK}")}"
SOURCE="${SOURCE:-/dev/stdin}"
CVT_TABS="No"
@@ -511,6 +512,7 @@ CVT_TABS="No"
[[ ${LIST_EXPIRATION} ]] && show_expiration_options && exit 0
# language needs to be verified before it is escaped but after service is selected
+[[ -n "$(eval "echo \${DEFAULT_LANGUAGE_${SERVICE}}")" ]] && LANGUAGE="${LANGUAGE:-$(eval "echo \${DEFAULT_LANGUAGE_${SERVICE}}")}"
LANGUAGE="${LANGUAGE:-${DEFAULT_LANGUAGE}}"
# uses ${SERVICE} and ${LANGUAGE}. may change the value of the latter.
verify_language