all repos — scriptura @ a41c97c06c8d611555b6b34780138efdbdf170d4

a corner in $HOME for your scripts

fix `--new` failing when creating a directory

Alan Pearce
commit

a41c97c06c8d611555b6b34780138efdbdf170d4

parent

3bc3dd964a6f4d190040fccefbd9b0e85d1af0d5

2 files changed, 10 insertions(+), 1 deletion(-)

changed files
M functions/__scriptura_new.fishfunctions/__scriptura_new.fish
@@ -2,7 +2,7 @@ function __scriptura_new --argument-names target
set --function remaining $argv[2..-1] if not path is --type dir (path dirname $target) - mkdir -p $target + mkdir -p (path dirname $target) end if path is --type file $target
M tests/scriptura.fishtests/scriptura.fish
@@ -84,6 +84,15 @@ scriptura --new shebang_test
head -n 1 "$test_root/shebang_test" ) = "#!/usr/bin/env fish" +# Test: --new creates component directories +@test "--new creates component directories" ( + set --global --export SCRIPTURA_ROOT $test_root + set --global --export SCRIPTURA_EDITOR "touch" + scriptura --new foo bar baz + path is --type dir "$test_root/foo/bar" + path is --type file --perm exec "$test_root/foo/bar/baz" +) $status -eq 0 + # Test: --new fails if script already exists @test "--new fails if script already exists" -n ( set --global --export SCRIPTURA_ROOT $test_root