all repos — scriptura @ 163c71b4eba9ad76fb28a11a581091ac0177fd07

a corner in $HOME for your scripts

refactor functions

Alan Pearce
commit

163c71b4eba9ad76fb28a11a581091ac0177fd07

parent

62e5f98ddf2b6d02d9b89a70a9bc81933de0a1f8

1 file changed, 34 insertions(+), 33 deletions(-)

changed files
M functions/scriptura.fishfunctions/scriptura.fish
@@ -46,48 +46,49 @@ break
end end + if test $valid -eq 0 + echo "scriptura: don't know what to do with target \"$argv\"" >&2 + return 1 + end + set --local remaining $argv[(math $valid + 1)..-1] - if test $valid -gt 0 + if set --query _flag_help + __scriptura_help $target + return $status + end - if set --query _flag_help - __scriptura_help $target - return $status - end + if set --query _flag_new + __scriptura_new $target $remaining + return $status + end - if set --query _flag_new - __scriptura_new $target $remaining - return $status - end + if set --query _flag_edit + __scriptura_edit $target + return $status + end + + if set --query _flag_which + __scriptura_which $target $remaining + return $status + end - if set --query _flag_edit - __scriptura_edit $target - return $status - end + if set --query _flag_cat + __scriptura_cat $target + return $status + end - if set --query _flag_which - __scriptura_which $target $remaining + if set --query script + if path is --perm exec $target + $target $remaining return $status - end - - if set --query _flag_cat + else + echo "scriptura: $target is not executable" >&2 __scriptura_cat $target return $status end - - if set --query script - if path is --perm exec $target - $target $remaining - return $status - else - echo "scriptura: $target is not executable" >&2 - __scriptura_cat $target - return $status - end - else if path is --type dir $target; and test (count $remaining) -eq 0 - __scriptura_list $target - return $status - end + else if path is --type dir $target; and test (count $remaining) -eq 0 + __scriptura_list $target + return $status end - echo "scriptura: don't know what to do with target \"$argv\"" >&2 end