Skip to content
Snippets Groups Projects
Commit 4aedc291 authored by Roman Inflianskas's avatar Roman Inflianskas Committed by Bruno Pinto
Browse files

[dpaste] Underscoring all private variables and functions

parent 9ce45f5f
No related merge requests found
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
# Based on oh-my-zsh's sprunge plugin # 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 ] if [ -z $dpaste_keyword ]
set -g dpaste_keyword content set -g dpaste_keyword content
end end
...@@ -17,57 +17,57 @@ function dpaste_set_defaults ...@@ -17,57 +17,57 @@ function dpaste_set_defaults
end end
end end
function dpaste_send function __dpaste_send
# echo $dpaste_url >&2 # echo $dpaste_url >&2
# echo $dpaste_send_url >&2 # echo $__dpaste_send_url >&2
curl -F "$dpaste_keyword=<-" $dpaste_send_url curl -F "$dpaste_keyword=<-" $__dpaste_send_url
end end
function dpaste_parse_expires function __dpaste_parse_expires
set expires_spec "-t $dpaste_expires_choises" 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/') 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 $dpaste_expires | sed -r "s/$dpaste_expires_choises//") ] if [ -z (echo $expires | sed -r "s/$__dpaste_expires_choises//") ]
set dpaste_send_url "$dpaste_send_url&expires=$dpaste_expires" set __dpaste_send_url "$__dpaste_send_url&expires=$expires"
end end
echo $argv | sed -r "s/$expires_spec//" echo $argv | sed -r "s/$expires_spec//"
end end
function dpaste_help function __dpaste_help
echo -e \ echo -e \
"Usage: "Usage:
dpaste [-t EXPIRES] < README.md dpaste [-t EXPIRES] < README.md
dpaste [-t EXPIRES] README.md dpaste [-t EXPIRES] README.md
cat README.md | dpaste [-t EXPIRES] cat README.md | dpaste [-t EXPIRES]
dpaste [-t EXPIRES] "I \<3 to paste" dpaste [-t EXPIRES] \"I \<3 to paste\"
Options: Options:
-t EXPIRES set snippet expiration time: $dpaste_expires_choises [default: month]" -t EXPIRES set snippet expiration time: $__dpaste_expires_choises [default: month]"
end end
function dpaste_parse_help function __dpaste_parse_help
if contains -- -h $argv if contains -- -h $argv
dpaste_help __dpaste_help
end end
end end
function dpaste function dpaste
dpaste_set_defaults __dpaste_set_defaults
set -g dpaste_send_url $dpaste_url set -g __dpaste_send_url $dpaste_url
dpaste_parse_help $argv __dpaste_parse_help $argv
or begin or begin
set argv (dpaste_parse_expires $argv) set argv (__dpaste_parse_expires $argv)
if isatty if isatty
if [ -n $argv ] if [ -n $argv ]
if [ -f $argv ] if [ -f $argv ]
cat $argv cat $argv
else else
echo $argv echo $argv
end | dpaste_send end | __dpaste_send
else else
dpaste_help __dpaste_help
end end
else else
dpaste_send __dpaste_send
end end
end end
end end
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment