You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can never remember how to set the path persistently in fish, When I google it I end up at issue #527 but the discussion there is a bit confused. I suggest two things:
Add a command add_to_path that is idempotent and validates the path.
Edit the top comment of How to set $PATH persistently? #527 or the title to point out this new way so people who end up there from google get the right information. Google results changes too slowly!
I have written a draft of an implementation of add_to_path:
#!/usr/bin/env fishif argparse -n'fish-add-user-path'-N 1 'h/help' -- $argv
;
elseexitendfunction add_to_path_if_not_there
set exists 0
# normalize path to end with /switch$argvcase"*/"set new_path $argvcase"*"set new_path "$argv/"endfor x in (string split""$fish_user_paths)
iftest"$x" = "$new_path"set exists 1
breakendendiftest"$exists" = "0"set-Ux fish_user_paths $fish_user_paths$new_pathendend# validate that paths existsfor x in (string split""$argv)
iftest-d$x
;
elseecho"Path '$x' does not exist"exitendendfor x in (string split""$argv)
add_to_path_if_not_there $xend
This is my first fish program so please help me in making it suck less :P
(This has been discussed in #527 previously)
I can never remember how to set the path persistently in fish, When I google it I end up at issue #527 but the discussion there is a bit confused. I suggest two things:
add_to_paththat is idempotent and validates the path.I have written a draft of an implementation of
add_to_path:This is my first fish program so please help me in making it suck less :P
ping @jonlorusso @knightsamar @kegesch @raunyoliveira-hotmart @i-am-the-slime @samhh @brianmhunt @radoslawc @cumulotimbus @AnotherCoolDude and many more that have seemed to think this is a good idea.