question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disparity between PSReadLine + *-History commands creates confusion

See original GitHub issue

Given that the decision has been made to require and integrate an external module PSReadLine for command handling, it’s confusing ( PowerShell/PowerShell#5711 PowerShell/PSReadLine#1074 ) and redundant to have two copies of the history, and the commands which modify history should be made to (optionally?) modify both.

Right now, the PowerShell History is numbered, and supports re-invoking via Invoke-History (or r) and also via tab-completion like #1{Tab}, but PSReadLine owns the hotkeys and search!

The PSReadLine history is persistent, but only the PowerShell History has commands to import/export/clear it – which allow one to modify what’s stored in the history in the case one accidentally types something one doesn’t want logged.

Obviously there’s a substantial difference between them, architecturally – since PSReadLine’s history only contains the actual command-lines, but the actual history retrieved by Get-History includes the status, as well as the start and end time…

However, this dichotomy, combined with the use of bash-similar aliases (history and r etc) and hotkeys which sometimes return different (or no) results is confusing and should be resolved – ideally, by having the history commands work on (or appear to work on) the same (size) persistent history buffer as PSReadLine.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:6
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
Jaykulcommented, Aug 13, 2018

For the record (here in the future): July ended with 3.97M startups of PowerShell Core 6. 82% of them on Linux. I think we can end the debate about whether it’s needed: clearly the vast majority of people using PS6 are on Linux and therefore need a ReadLine module.

1reaction
rkeithhillcommented, Feb 5, 2018

If you don’t include PSReadLine by default on Linux and macOS, you might as well pack it up and go home. Without PSRL, PowerShell line editing is too far behind Bash for folks to take PowerShell seriously - on those platforms.

You can add Remove-Module PSReadLine to your profile to remove it - if that’s what you’d prefer - even on PS Core.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove cmdlet/cmd that error from history to reduce ...
Are erroring commands distracting for the user to have in history predictions? Is it confusing for a failed command to not show up...
Read more >
Easily Search PowerShell Command History With ...
A fun experiment for this is to open a new console, run Remove-Module PSReadline and then see what's missing. The two biggest things...
Read more >
Powershell PSReadLine History
PSReadLine uses its own history (in memory and saved in (Get-PSReadLineOption).HistorySavePath ). Commands entered using PSReadLine are ( ...
Read more >
Making VS Code's Powershell Integrated Console useful
Let's take a look at the differences between the two, ... it's called the Integrated Terminal, but don't confuse that for the Powershell ......
Read more >
How To Use PowerShell History On Multiple Devices
The article describes how you can shorten the process of typing the same commands time and time again by using the same commands...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found