Modify repo to be installable via fisher

This commit is contained in:
mitchell 2020-10-29 23:29:20 -04:00
parent 3b495dad5b
commit f3d8897187
3 changed files with 35 additions and 10 deletions

View File

@ -1,3 +1,22 @@
function sw -d 'The fish-based project script runner'
argparse --ignore-unknown 'i-init' -- $argv
set -g cmd_func_prefix 'swim'
if test -n "$_flag_init"
curl -fsS https://raw.githubusercontent.com/mitchell/swim.fish/master/swim.fish.example >swim.fish
return
end
if test -f ./swim.fish
source ./swim.fish
else
echo 'No swim.fish found. Run `sw --init` make one.'
return 1
end
run_swim_command $cmd_func_prefix $argv
end
function run_swim_command -a prefix function run_swim_command -a prefix
argparse --ignore-unknown 'h/help' -- $argv argparse --ignore-unknown 'h/help' -- $argv
set -l command $argv[2] set -l command $argv[2]

12
sw
View File

@ -1,14 +1,20 @@
#!/usr/bin/env fish #!/usr/bin/env fish
function main
argparse --ignore-unknown 'i-init' -- $argv
set -g cmd_func_prefix 'swim' set -g cmd_func_prefix 'swim'
if test -n "$_flag_init"
curl -fsS https://raw.githubusercontent.com/mitchell/swim.fish/master/swim.fish.example >swim.fish
return
end
if test -f ./swim.fish if test -f ./swim.fish
source ./swim.fish source ./swim.fish
else else
echo 'No swim.fish found in current directory. Please copy the template from https://github.com/mitchell/swim.fish' echo 'No swim.fish found. Run `sw --init` make one.'
exit 1 return 1
end end
function main
run_swim_command $cmd_func_prefix $argv run_swim_command $cmd_func_prefix $argv
end end

View File

@ -73,5 +73,5 @@ function swim_fails -d 'This command fails every time'
false false
end end
#curl -fsS https://raw.githubusercontent.com/mitchell/swim.fish/master/importable_sw.fish | source #curl -fsS https://raw.githubusercontent.com/mitchell/swim.fish/master/functions/sw.fish | source
#run_swim_command $cmd_func_prefix $argv #run_swim_command $cmd_func_prefix $argv