This commit is contained in:
Bruno Pinto 2013-11-20 07:53:39 -02:00
parent 5ed6752201
commit 00236e5af3
4 changed files with 141 additions and 143 deletions

View File

@ -9,5 +9,4 @@ function djtest
else else
time python manage.py test $VERBOSE time python manage.py test $VERBOSE
end end
end end

View File

@ -12,77 +12,77 @@ function emoji-clock
set minutes (date '+%M') set minutes (date '+%M')
switch $hour switch $hour
case 01 case 01
if test $minutes -ge 30 if test $minutes -ge 30
set clock "🕜" set clock "🕜"
else else
set clock "🕐" set clock "🕐"
end end
case 02 case 02
if test $minutes -ge 30 if test $minutes -ge 30
set clock "🕝" set clock "🕝"
else else
set clock "🕑" set clock "🕑"
end end
case 03 case 03
if test $minutes -ge 30 if test $minutes -ge 30
set clock "🕞" set clock "🕞"
else else
set clock "🕒" set clock "🕒"
end end
case 04 case 04
if test $minutes -ge 30 if test $minutes -ge 30
set clock "🕟" set clock "🕟"
else else
set clock "🕓" set clock "🕓"
end end
case 05 case 05
if test $minutes -ge 30 if test $minutes -ge 30
set clock "🕠" set clock "🕠"
else else
set clock "🕔" set clock "🕔"
end end
case 06 case 06
if test $minutes -ge 30 if test $minutes -ge 30
set clock "🕡" set clock "🕡"
else else
set clock "🕕" set clock "🕕"
end end
case 07 case 07
if test $minutes -ge 30 if test $minutes -ge 30
set clock "🕢" set clock "🕢"
else else
set clock "🕖" set clock "🕖"
end end
case 08 case 08
if test $minutes -ge 30 if test $minutes -ge 30
set clock "🕣" set clock "🕣"
else else
set clock "🕗" set clock "🕗"
end end
case 09 case 09
if test $minutes -ge 30 if test $minutes -ge 30
set clock "🕤" set clock "🕤"
else else
set clock "🕘" set clock "🕘"
end end
case 10 case 10
if test $minutes -ge 30 if test $minutes -ge 30
set clock "🕥" set clock "🕥"
else else
set clock "🕙" set clock "🕙"
end end
case 11 case 11
if test $minutes -ge 30 if test $minutes -ge 30
set clock "🕦" set clock "🕦"
else else
set clock "🕚" set clock "🕚"
end end
case 12 case 12
if test $minutes -ge 30 if test $minutes -ge 30
set clock "🕧" set clock "🕧"
else else
set clock "🕛" set clock "🕛"
end end
case '*' set clock "⌛" case '*' set clock "⌛"
end end
echo $clock echo $clock

View File

@ -1,20 +1,19 @@
# gitignore.io cli for fish # gitignore.io cli for fish
#
function gi function gi
#curl http://gitignore.io/api/$argv #curl http://gitignore.io/api/$argv
set -l params (echo $argv|tr ' ' ',') set -l params (echo $argv|tr ' ' ',')
curl http://gitignore.io/api/$params curl http://gitignore.io/api/$params
end end
# enable the complation by invoking `gi list` # enable the complation by invoking `gi list`
if not set -q -g gi_list if not set -q -g gi_list
timeout 2 ping -c 1 -q gitignore.io >/dev/null timeout 2 ping -c 1 -q gitignore.io >/dev/null
set gi_available $status set gi_available $status
if test $gi_available if test $gi_available
set -g gi_list (gi list| tr ',' ' ' ^/dev/null) set -g gi_list (gi list| tr ',' ' ' ^/dev/null)
end end
end end
complete -c gi -a "$gi_list" complete -c gi -a "$gi_list"

View File

@ -1,87 +1,87 @@
# PHP HTTP server. # PHP HTTP server.
function phphttp function phphttp
set -l port 8000 set -l port 8000
set -l path set -l path
set -l host 127.0.0.1 set -l host 127.0.0.1
# Ignore argument for slice. # Ignore argument for slice.
set argv $argv ignore set argv $argv ignore
# Process options. I think that fish should have some builtin for # Process options. I think that fish should have some builtin for
# option parsing, but it doesn't. # option parsing, but it doesn't.
while count $argv > /dev/null while count $argv > /dev/null
set -l option $argv[1] set -l option $argv[1]
switch $option switch $option
# When two hyphens appear, stop processing, while removing # When two hyphens appear, stop processing, while removing
# hyphens from $argv. # hyphens from $argv.
case -- case --
set argv $argv[2..-1] set argv $argv[2..-1]
break break
# Public mode. # Public mode.
case -p\* --p --pu --pub --publ --publi --public p public case -p\* --p --pu --pub --publ --publi --public p public
if test $host = 0 if test $host = 0
echo phphttp: Duplicate option --public >&2 echo phphttp: Duplicate option --public >&2
end end
set host 0 set host 0
# Help. # Help.
case -h\* --h --he --hel --help '-\?' h help case -h\* --h --he --hel --help '-\?' h help
echo 'phphttp [--public] <port=8000> <path=.>' echo 'phphttp [--public] <port=8000> <path=.>'
return return
# Anything else stops processing. # Anything else stops processing.
case \* case \*
break break
end
# Check if the option was one letter.
switch $option
case --\*
# Doesn't count as single option
case -\?\?\*
set argv[1] -(expr substr $argv[1] 3 length $argv[1])
continue
end
set argv $argv[2..-1]
end end
if test (count $argv[1..-1]) -ge 4 # Check if the option was one letter.
echo 'phphttp: Expected up to two arguments, got '(math (count $argv) - 1)'.' >&2 switch $option
case --\*
# Doesn't count as single option
case -\?\?\*
set argv[1] -(expr substr $argv[1] 3 length $argv[1])
continue
end
set argv $argv[2..-1]
end
if test (count $argv[1..-1]) -ge 4
echo 'phphttp: Expected up to two arguments, got '(math (count $argv) - 1)'.' >&2
return
end
# argv is bigger by 1 because of "ignore" argument.
if test (count $argv) -ge 2
# Check legality of first argument
switch $argv[1]
# Fine values
case {0,1,2,3,4,5,6,7,8,9}\*
# Do nothing
case \*
# The dev team thinks of everything. Or something.
if test -d $argv[1]
if test (count $argv) -eq 2
echo "phphttp: directory specified without port." >&2
else
echo "phphttp: swapped directory and port arguments." >&2
end
return return
else
echo "phphttp: $argv[1] is not a port." >&2
return
end
end end
# argv is bigger by 1 because of "ignore" argument. set port $argv[1]
if test (count $argv) -ge 2 end
# Check legality of first argument if test (count $argv) -eq 3
switch $argv[1] set path -t$argv[2]
# Fine values end
case {0,1,2,3,4,5,6,7,8,9}\*
# Do nothing
case \* php -S$host:$port $path
# The dev team thinks of everything. Or something.
if test -d $argv[1]
if test (count $argv) -eq 2
echo "phphttp: directory specified without port." >&2
else
echo "phphttp: swapped directory and port arguments." >&2
end
return
else
echo "phphttp: $argv[1] is not a port." >&2
return
end
end
set port $argv[1]
end
if test (count $argv) -eq 3
set path -t$argv[2]
end
php -S$host:$port $path
end end