add support for powershell on MacOs and Linux
uru admin add
works as well as uru ls
but uru TAG
throws:
panic: uru invoked from unknown shell (check URU_INVOKER env var)
Comments (5)
-
repo owner -
reporter Right now I’m on a mac…haven’t tried/installed on linux yet.
- Yes, I am using pwsh as my main shell
$env:SHLVL
is0
$env:SHELL
is set to/bin/bash
(making uru think I am in bash)….I assume this value is inherited from somewhere and am not sure what damage would be done if I changed/removed it.
-
repo owner The problem is that the current version of
uru
doesn’t have the builtins for the switcher script and helper function magic on *nix w/pwsh. And I don’t think there’s a simple workaround like setting an envar to make it work. Will have to dig around a bit to see what it would take to implement. -
reporter This challenge inspired me to give my hand a try at the Go programming language for the first time.
These changes got
uru
working on my machine but I also needed changes in my powershell and bash profile scripts as follows:for ~/.config/powershell/Microsoft.Powershell_profile.ps1 I had to…
- explicitly assign
$env:SHELL = "/usr/local/bin/pwsh"
because by default is is/bin/bash
-
assign
$env:URU_HOME = "$env:HOME/.uru"
- edit: I just realized the uru script is using
$env:USERPROFILE
which is what is in windows….can fix by using$env:HOME
- edit: I just realized the uru script is using
-
define
function global:uru {...}
with the scriptblock being the output ofuru_rt admin install
for ~/.bashrc I had to…
- explicitly
export SHELL=/bin/bash
because launching bash from pwsh would cause the spawned process to inherit/usr/local/bin/pwsh
for the environment variable.
So far with these changes uru apperars to be correctly changing paths and allowing me to switch rubies correctly!
- explicitly assign
-
repo owner <shocked/>…an actual code tweak for this slow moving side project Cool to see your jump into Go…and my bowl of spaghetti code that is
uru
.Glad to hear you found a workaround for your environment. I’ll try to remember how my Go code works and spin up on your tweaks in the next few days.
I’d like to find a way to minimize the all the extra work you had to do to get it working. Ideally, I prefer the install to be no more than a single line in your
.bash_profile
like the normal Linux install, and leturu_rt
figure out where it’s running and take care of the rest automagically.Also looks like my assumptions about PS before pwsh-on-nix became a thing is a problem, i.e.
PSWrapper
inwrapper_windows.go
and no pwsh flavor inwrapper.go
for *nix environments similar toBashWrapper
andFishWrapper
. Who knows, the combo of pwsh$profile
and a simple bash+pwsh wrapper function may turn out not to be kludge.Maybe the combo of a quick tweak to
uru_rt
and a custom pwsh$profile
similar to what you did, and pwsh+*nix might need nothing in.bashrc/.bash_profile
assuming the spawned child process issue can be resolved.
- Log in to comment
I’ve no mac to try to repo, but I am using ps 7.0 on ubuntu 19.10 x64.
What’s your ps linux config and how are you using ps to call
uru
? Specifically, are you using ps as your main shell (aka bash replacement) or something else?