-
-
Notifications
You must be signed in to change notification settings - Fork 584
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
Add PowerShell module #2543
base: main
Are you sure you want to change the base?
Add PowerShell module #2543
Conversation
I've tested it and everything works well. Now I'm a happy user. Thank you for your work! |
Thank you @ltrzesniewski and lzybkr, appreciate the work ❤️ Confirming Successful Test on
About TestsDetails on test steps and commands run at https://github.com/justunsix/rust-tests/blob/main/atuin-tests/pr2543/README.md
Error not related to PRSharing an error found during testing in case others find it during their testing, though it is a local issue and not related to the PR itself. The error also occurs when testing with atuin/main in nushell in the same environment, so error
Error: migration 20230531212437 was previously applied but has been modified
>>
>> Location:
>> C:\Users\user1\usr\reference\atuin\crates\atuin-client\src\record\sqlite_store.rs:61:9
Error:: The term 'Error:' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
|
@justunsix thanks for testing and the detailed report! Sorry, I should have mentioned the database issue in the OP, I'll add a warning right now. 😬 |
fix as explained at atuinsh/atuin#2543 (comment)
This adds PowerShell support by invoking the following expression: atuin init powershell | Out-String | Invoke-Expression Co-authored-by: Jason Shirk <[email protected]>
cbefeb6
to
59c6f95
Compare
I found an issue with encoding and pushed a fix: I took the opportunity to add support for an The compiler was also complaining about an elided lifetime, but not every time for some reason, so I made it explicit. |
Re-tested after the push and confirming successful tests on:
Additions from the earlier testing:
Comments:
<TabItem label="powershell">
Add
```shell
atuin init powershell | Out-String | Invoke-Expression
```
to your $PROFILE file.
If you use a prompt that has more than one line, also add
```shell
$env:ATUIN_POWERSHELL_PROMPT_OFFSET=-X
```
to your $PROFILE file.
Replace X with the number of lines in your prompt, but take away 1.
For example, if your prompt has 2 lines, the environment variable would be -1.
</TabItem> |
This adds PowerShell support 🎉
I built this script around @lzybkr's prototype, so I added him as co-author (I hope that's ok). I wouldn't know where to start without his contribution.
I'm not a PowerShell expert, so this was a nice opportunity to learn some stuff. I think it's ok, but I would appreciate if someone more knowledgeable in the matter could review this though.
It would be nice if other PowerShell users could test this with their configs and report any issues. I wouldn't be surprised if there are some remaining bugs or missing features.
Fixes #84
Warning
Because of other changes on the
main
branch, please set the following environment variables to temporary file paths when testing:Otherwise, the database schema will be migrated to a new format, and you will have to stay with the Atuin version from this branch.
Installation
This requires
atuin
to be in the path and the PSReadLine module to be installed, which is the case by default.Tests
I tested this on the following:
I also tested this with and without my custom Oh My Posh prompt. It works fine in both cases, except that since my OMP config contains
"newline": true
, my prompt is multiline and shifts downwards by a single line on eachatuin search -i
invocation. This can be adjusted with the$env:ATUIN_POWERSHELL_PROMPT_OFFSET
environment variable (e.g. I set mine to-1
to account for the additional prompt line).Other notes
I added the following before the first draw call, since I got Atuin drawing over my PS prompt without entirely erasing it:
Checks