all repos — scriptura @ 3bc3dd964a6f4d190040fccefbd9b0e85d1af0d5

a corner in $HOME for your scripts

read remaining args to `--new --` as script content

Alan Pearce
commit

3bc3dd964a6f4d190040fccefbd9b0e85d1af0d5

parent

2ad533210f375712ba2e16104c2bf49b9096e9e0

1 file changed, 6 insertions(+), 3 deletions(-)

changed files
M functions/__scriptura_new.fishfunctions/__scriptura_new.fish
@@ -1,4 +1,6 @@
function __scriptura_new --argument-names target + set --function remaining $argv[2..-1] + if not path is --type dir (path dirname $target) mkdir -p $target end
@@ -8,9 +10,10 @@ echo "Error: $target already exists"
return 1 end - printf "%s\n\n" "#!/usr/bin/env fish" >$target + printf "%s\n%s\n" "#!/usr/bin/env fish" "$remaining" >$target chmod +x $target - __scriptura_edit $target + if test (count $remaining) -eq 0 + __scriptura_edit $target + end end -