New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: AWS segment #380
Comments
2 things we can do:
The first option will unblock you, the second one makes the most sense in the long run ;-) |
I might be experimenting with an AWS segment :) Curious if a custom segment would allow me access to local PowerShell variables though? Inside the segment running Would the custom segment still need to use the Set-PoshContext trick in the Prompt? |
@ppittle you can't access Powershell variables as that runs in a different process. You can call environment variables (AWS cli sets these) and display those or call that AWS cli directly. |
@ppittle can you check the latest version offers what you're looking for? |
Trying this out on Win10 / pwsh 7.1.1 and not seeing anything shown for the AWS template. Just to clarify, this template will look for the $env:AWS_PROFILE and similar variables, right? |
@glucas yes, and the config file. How did you add the segment? Because I still have a bug in the docs 😅 |
Ha, I just copied the example from the doc! |
That should be correct, did you update? |
@JanDeDobbeleer that's fantastic! I tweaked out the template to replace the @ with an orange amazon logo and dropped the prefix character:
|
Feel free to close this when your request is resolved. |
Interesting, I get nothing. I grabbed the segment from the doc and added it to my theme. I'm setting $env:AWS_PROFILE and $env:AWS_REGION in my pwsh shell. I'll experiment further. I can |
@glucas ok, but did you update oh-my-posh? Otherwise it won't work. |
Yes, this is my fault. I've been updating oh-my-posh3 via scoop to newer versions, but now realize I separately have the powershell module installed and that is on an older version. Once again, apologies for the noise! Works great now - this is very useful, thanks for the great package. |
One possible enhancement for the AWS segment would be to only show when the profile is not 'default'. I think I can achieve something similar with if conditions in the template, however. |
@glucas not necessarily, that's an additional feature :-) But very doable indeed. I'll add it. |
@glucas added with the newly available |
Hi Jan, For example with AWS_PROFILE, the active profile should be the one called "default" from the config file, but it is not displayed. Could you clarify how the config is loaded? I think it would also be nice to get a status if the authentication is valid or expired, and extra infromations like the account connected and so on, essentially to get something like the output of |
Appreciate the quick reply, but take your time 😂 not urgent at all! |
@alefranz For what it's worth, I am running pwsh and when I enable the AWS segment it in fact shows me the default profile name and region, with no AWS variables set: In my case I'd prefer to only see this for non-default values but that should be a separate feature request, I'll file it. |
@glucas you can set the property |
Prerequisites
CONTRIBUTING
guideDescription
Is it possible to have a local powershell variable display in a segment? (And be performant while doing so?)
I tried with the following segment which I want to write out
$localVar
:But the command segment doesn't print anything:
Context:
For context, I'm basically trying to port the custom Prompt in this old aws blog on powershell for aws and port it to work inside oh-my-posh.
Environment
Steps to Reproduce
$localVar
totest
Expected behavior: Prompt reads local variable and displays
test
Actual behavior:
Test
is not printed inside the PromptThe text was updated successfully, but these errors were encountered: