[dpaste] Underscoring all private variables and functions

This commit is contained in:
Roman Inflianskas 2014-06-09 11:10:57 +04:00 committed by Bruno Pinto
parent 9ce45f5f38
commit 4aedc2917f

View File

@ -6,9 +6,9 @@
# Based on oh-my-zsh's sprunge plugin
set dpaste_expires_choises '(onetime|never|hour|week|month)'
set __dpaste_expires_choises '(onetime|never|hour|week|month)'
function dpaste_set_defaults
function __dpaste_set_defaults
if [ -z $dpaste_keyword ]
set -g dpaste_keyword content
end
@ -17,57 +17,57 @@ function dpaste_set_defaults
end
end
function dpaste_send
function __dpaste_send
# echo $dpaste_url >&2
# echo $dpaste_send_url >&2
curl -F "$dpaste_keyword=<-" $dpaste_send_url
# echo $__dpaste_send_url >&2
curl -F "$dpaste_keyword=<-" $__dpaste_send_url
end
function dpaste_parse_expires
set expires_spec "-t $dpaste_expires_choises"
set dpaste_expires (echo $argv | sed -r "s/.*$expires_spec.*/\1/" | sed 's/hour/3600/' | sed 's/week/604800/' | sed 's/month/2592000/')
if [ -z (echo $dpaste_expires | sed -r "s/$dpaste_expires_choises//") ]
set dpaste_send_url "$dpaste_send_url&expires=$dpaste_expires"
function __dpaste_parse_expires
set expires_spec "-t $__dpaste_expires_choises"
set expires (echo $argv | sed -r "s/.*$expires_spec.*/\1/" | sed 's/hour/3600/' | sed 's/week/604800/' | sed 's/month/2592000/')
if [ -z (echo $expires | sed -r "s/$__dpaste_expires_choises//") ]
set __dpaste_send_url "$__dpaste_send_url&expires=$expires"
end
echo $argv | sed -r "s/$expires_spec//"
end
function dpaste_help
function __dpaste_help
echo -e \
"Usage:
dpaste [-t EXPIRES] < README.md
dpaste [-t EXPIRES] README.md
cat README.md | dpaste [-t EXPIRES]
dpaste [-t EXPIRES] "I \<3 to paste"
dpaste [-t EXPIRES] \"I \<3 to paste\"
Options:
-t EXPIRES set snippet expiration time: $dpaste_expires_choises [default: month]"
-t EXPIRES set snippet expiration time: $__dpaste_expires_choises [default: month]"
end
function dpaste_parse_help
function __dpaste_parse_help
if contains -- -h $argv
dpaste_help
__dpaste_help
end
end
function dpaste
dpaste_set_defaults
set -g dpaste_send_url $dpaste_url
dpaste_parse_help $argv
__dpaste_set_defaults
set -g __dpaste_send_url $dpaste_url
__dpaste_parse_help $argv
or begin
set argv (dpaste_parse_expires $argv)
set argv (__dpaste_parse_expires $argv)
if isatty
if [ -n $argv ]
if [ -f $argv ]
cat $argv
else
echo $argv
end | dpaste_send
end | __dpaste_send
else
dpaste_help
__dpaste_help
end
else
dpaste_send
__dpaste_send
end
end
end