Basename able to deal with .git repos

This commit is contained in:
~erin 2023-04-02 12:36:09 -04:00
parent 99a69219f9
commit 3305d85492
Signed by: erin
GPG Key ID: 9A8E308CEFA37A47
1 changed files with 7 additions and 5 deletions

View File

@ -41,6 +41,8 @@ function build
return 1 return 1
end end
set -x BASENAME $(basename $REPOSITORY | sed 's/.git//g')
switch $_flag_compiler switch $_flag_compiler
case 'cargo' case 'cargo'
set -x COMPILER $_flag_compiler set -x COMPILER $_flag_compiler
@ -94,9 +96,9 @@ function build
end end
if $RELEASE if $RELEASE
set -x BINARY_PATH '~/src/'(basename $REPOSITORY)'/target/release/'(basename $REPOSITORY) set -x BINARY_PATH '~/src/'$BASENAME'/target/release/'$BASENAME
else else
set -x BINARY_PATH '~/src/'(basename $REPOSITORY)'/target/debug/'(basename $REPOSITORY) set -x BINARY_PATH '~/src/'$BASENAME'/target/debug/'$BASENAME
end end
# TODO: Add colours # TODO: Add colours
@ -126,6 +128,7 @@ function build
return 1 return 1
end end
if set -ql FEATURES if set -ql FEATURES
if $RELEASE if $RELEASE
set -x BUILD_COMMAND $COMPILER $SUBCOMMAND '--release --features' $FEATURES set -x BUILD_COMMAND $COMPILER $SUBCOMMAND '--release --features' $FEATURES
@ -139,7 +142,7 @@ function build
set_color white set_color white
echo -e '\n' echo -e '\n'
set -xl COMMANDS 'cd ~/src; git clone' $REPOSITORY '; cd ' (basename $REPOSITORY) '; ' $BUILD_COMMAND set -xl COMMANDS 'cd ~/src; git clone' $REPOSITORY '; cd ' $BASENAME '; ' $BUILD_COMMAND
ssh -t $HOST $COMMANDS ssh -t $HOST $COMMANDS
else else
if $RELEASE if $RELEASE
@ -154,7 +157,7 @@ function build
set_color white set_color white
echo -e '\n' echo -e '\n'
set -xl COMMANDS 'cd ~/src; git clone' $REPOSITORY '; cd ' (basename $REPOSITORY) '; ' $BUILD_COMMAND set -xl COMMANDS 'cd ~/src; git clone' $REPOSITORY '; cd ' $BASENAME '; ' $BUILD_COMMAND
ssh -t $HOST $COMMANDS ssh -t $HOST $COMMANDS
end end
@ -164,7 +167,6 @@ function build
echo $BINARY_PATH echo $BINARY_PATH
set_color white set_color white
echo $_flag_destination
if set -ql _flag_destination if set -ql _flag_destination
scp $HOST:$BINARY_PATH $_flag_destination scp $HOST:$BINARY_PATH $_flag_destination
else else