Closed zch-lusa closed 1 year ago
Looks like powershell script should be little bit different. Does anyone know?
The powershell script in your README is fine in the sense that executing my_ll <path>
defined below works as expected:
function my_ll() {
cd "$(echo $args)"
}
So it's a problem with llama returning an error instead of path. Possibly this line is erroring https://github.com/antonmedv/llama/blob/master/main.go#L76 output := termenv.NewOutput(os.Stderr)
. Seems strange to have not tested it.
As an addition when i call llama.exe "manually" and then exit with esc, the outputting of the path works. Somehow the script seems to not find the correct handle to put the output to in the powershell-script case:
I'm seeing the same thing here.
Also, could the PowerShell command be simplified to
llama | cd
It seems to work, even with the error messages.
Looks like the problem is in upstream dependency: https://github.com/charmbracelet/gum/issues/32
@mike-ward: For me this just prints the error message at the time I execute ll
. After that it works with the cd but just looks not nice as the folders are kind of "over" the error message.
@mike-ward I also received undesirable results with the llama | cd
approach, unfortunately.
@zch-lusa I was able to put together a simple workaround that seemed to behave as expected during my testing; you can modify your powershell script to the following:
function ll() {
cd $(llama $args | Out-String -Stream)[-1]
}
This is by no means a perfect solution as this will ignore the error message altogether by splitting the llama output by line and simply grabbing the last line (which for me was always the desired path), but this should at least get you rolling until a better long-term solution is put together.
@mike-ward I also received undesirable results with the
llama | cd
approach, unfortunately.@zch-lusa I was able to put together a simple workaround that seemed to behave as expected during my testing; you can modify your powershell script to the following:
function ll() { cd $(llama $args | Out-String -Stream)[-1] }
This is by no means a perfect solution as this will ignore the error message altogether by splitting the llama output by line and simply grabbing the last line (which for me was always the desired path), but this should at least get you rolling until a better long-term solution is put together.
It helps, Windows 11 powershell, if it's a dependency-level error, can add it to the README until it's fixed? Better not an ideal solution than non-working ones
@zch-lusa can i ask what version of powershell are you use?
It seems that powershell 5.1
, crookedly shows errors after using llama, on powershell 7
at myself and in your screenshots, I don't see this. Maybe it makes sense to open an Issue, or just mention it in the README
Name Value
PSVersion 7.3.0 PSEdition Core GitCommitId 7.3.0 OS Microsoft Windows 10.0.22000 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0
Seems to be ps 7
edit: whoops different account :) i am zch-lusa
Should be fixed.
I get this error message on windows powershell.
What i did:
Expected behavior: Setting Location to my selected location Actual Behavior: Error above
Any idea where this is from?