tadzik / rakudobrew

Perl 6 installation manager
MIT License
185 stars 42 forks source link

translating `rakudobrew init` for fish shell? #71

Closed OwenAR closed 5 years ago

OwenAR commented 8 years ago

i use fish shell

(i honestly barely learned bash in the first place, and still don't know fish super well)

so, the bash function that comes out of rakudobrew init -, should i translate that to an auto-loading fish function?

i tried just naively translating it line-by-line

#bash rakudobrew() {
function rakudobrew
#bash   local command
#bash   command="$1"
    set --local command $argv[1]

#bash   if [ "$#" -gt 0 ]; then
    if test (count $argv) -gt 0
#bash     shift
        if test (count $argv) -gt 1
            set argv $argv[2..-1]
        else
            set --erase argv
        end
#bash   fi
    end

#bash   case "$command" in
    switch "$command"
#bash   shell)
        case shell
#bash     eval "`rakudobrew "sh" "$@"`";;
            eval (rakudobrew "sh" $argv)
#bash   *)
        case "*"
#bash     command rakudobrew "$command" "$@";;
            command rakudobrew $command $argv
#bash   esac
    end
#bash }
end

but it came out as an unreadable mess, because i don't actually understand, what is the purpose of this function?

like, in terms of the list of test inputs and what it's supposed to do with them

like, is it just supposed to turn "shell" to "sh"?

rakudobrew                  >   command rakudobrew
rakudobrew foo              >   command rakudobrew foo
rakudobrew foo bar          >   command rakudobrew foo bar
rakudobrew shell            >   command rakudobrew sh
rakudobrew shell foo        >   command rakudobrew sh foo
rakudobrew shell foo bar    >   command rakudobrew sh foo bar

or something else...?

( also,

it said to add this to my (implicitly bash) profile:

export PATH="/home/o1/.rakudobrew/bin:${PATH}"

which would mean, naively translating, adding this to my config.fish:

set --export PATH $HOME/.rakudobrew/bin $PATH

but i already have that in my path from following the direction in the readme to run:

set -U fish_user_paths ~/.rakudobrew/bin/ $fish_user_paths

)

slobo commented 8 years ago

Except for rakudobrew shell (which I don't know what it's supposed to do), just setting fish_user_paths seems to be enough to get it to work on fish. ymmv

patrickbkr commented 5 years ago

A refactor done a few weeks ago implemented fish support. So I'll close this.