-
Notifications
You must be signed in to change notification settings - Fork 7.2k
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
History stack not empty #20025
Comments
In the |
Isn't step 1 already enough to empty all entities of history thus empty all history stacks of all times? |
No. It relates only on PSReadline history. I think you could add |
As sole goals:
That makes |
?? |
What did you think you would achieve by manipulating irrationally someone's writings. That's a pattern you won't observe with a genuine developer. Indeed your ??; that what you get when you play that game. How could you assume that a reader other than you would not notice your trick? You just made yourself a reputation. |
How I could understand you? I asked you:
Your answer:
Did you do mean all history stacks of all times, current history and saved one? I understood that you do not need a history at all, but how else to understand? |
Update: This comment originally lacked proper framing: it tries to provide general information about how PSReadLine manages its history. I cannot reproduce the symptom described in the initial post.
|
I can observe myself that
Didn't this imply all history stacks of all times, which itself implied all those saved.
Didn't this imply history of the current session is needed, hence must be saved in order to be available in the current session and at last must be emptied at the end of session so that the condition No history stack available at start of new session. can be met. What we learned from the comment history of the present ticket is that all this activity happened before your comment of Jul 25, 2023, 9:30 PM GMT+3. |
I needed a proper answer, so I had to investigate to find a source that provided it. Finally I was able to find it, although provided by a non-Microsoft source. I make a note here for myself for record purpose.
|
For what it's worth, I cannot reproduce the symptoms described in your initial post. My previous comment (since-amended) was basically an attempt to generally describe how PSReadLine manages its history As for your latest solution:
Either way, let me add some more general information for those interested in (possibly selectively) preventing PSReadLine from recording or saving history:
# To be safe, remove any existing history file, not just one that predates this configuration, but also
# ones that may have been created when PowerShell was started with -NoProfile
if (Test-Path (Get-PSReadlineOption).HistorySavePath) { Remove-Item -Force (Get-PSReadlineOption).HistorySavePath }
# Tell PSReadLine not to *save* (persist) the command history, but make the history of
# the *current session's* commands available in-memory, in-session.
Set-PSReadlineOption -HistorySaveStyle SaveNothing
|
It's statistically good. At least one developer who was unable to reproduce the symptom described in this report. However unknown is still your demonstration. I can't wait to read, probably like anyone here, how you managed to not get a non-empty history stack at the start of new sessions using those very commands presented in this report. As for the very case I was reasonably expecting one of yours to recommend the use of a permanent alias for the command I naively assumed it would be as simple as Unix/Linux made it. I had to learn that it would have been too good to be true. So we won't know neither how you would have done, by choosing to keep things simple. Yet too often i can testify how some developers easily became addictive to cultivate the Art of doing things by complicating them even when they could be done with simplicity.. |
|
No need to bother to pretend. Who is still unaware today of how everything is destined to end at Microsoft? The correct answer, and nothing else. This is what I and any reader were entitled to expect. Even I, novice in regard to code culture practises at Microsoft, I am able to manage answering properly, then by fully meeting the requirements here set, which i do now. I have to assume the reader is fully aware of those nameless things that are called in Microsoft's jargon PowerShell, Windows Defender; let's stop here, i have not time to lose by citing its whole production. Fancy names, we get it. MethodologyCheck whether the Controlled folder access property is enabled: > Get-MpPreference | Select-Object -ExpandProperty EnableControlledFolderAccess
2 When it is, as administrator, add the PowerShell 7+ application as allowed in regard to Controlled folder access. > Add-MpPreference -ControlledFolderAccessAllowedApplications "C:\Program Files\PowerShell\7\pwsh.exe" Paths to each of the four profiles for the Windows PowerShell console: > ($PROFILE | Select-Object -ExcludeProperty Length | Format-List | Out-String).Trim()
AllUsersAllHosts : C:\Program Files\PowerShell\7\PROFILE.ps1
AllUsersCurrentHost : C:\Program Files\PowerShell\7\Microsoft.PowerShell_PROFILE.ps1
CurrentUserAllHosts : C:\Users\vince\Documents\PowerShell\PROFILE.ps1
CurrentUserCurrentHost : C:\Users\vince\Documents\PowerShell\Microsoft.PowerShell_PROFILE.ps1 Determine the existence of a profile; for instance $PROFILE: > Test-Path $PROFILE
False Then no profile exits yet for Create a new profile (is persistent), for instance for > New-Item -force -type file -path $PROFILE
Directory: C:\Users\[name]\Documents\PowerShell
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 8.15.2023 11.07 0 Microsoft.PowerShell_PROFILE.ps1 Create a new persistent alias, for instance for this profile:. To achieve this task, select preferably a text editor with support for code language syntax coloring to edit this profile; notepad++ will do. Model of alias: function [function_name] {
# to be run
}
Set-Alias [alias_name] [function_name] Alias that I have applied on my system; shown for convenience: function CurrentUserPowerShellHistoryCompleteVacuum {
Remove-Item -Confirm -LiteralPath C:\Users\$Env:UserName\appdata\roaming\microsoft\windows\powershell\PSReadLine\ConsoleHost_history.txt
Write-Output ""
Write-Output 'Now, if you chose to empty the history, end this session by closing this terminal within UI.'
}
Set-Alias vacuum CurrentUserPowerShellHistoryCompleteVacuum Once the profile saved, end your session by closing your terminal within UI. The modification will take effect at start of a new terminal session. At last, ensure the alias is operational by executing it; for instance
|
@Ricky-Tigg, to spare you frustration in the future, let me try to delineate what this repo is and isn't about:
|
Is it so? But if only it could only be that. But it is still [and you can go on for each of your It is about: and It is not:]. |
Prerequisites
Steps to reproduce
Expected behavior
History stack to be empty as a consequence of step _1_.
Actual behavior
History stack not empty.
Error details
No response
Environment data
Visuals
No response
The text was updated successfully, but these errors were encountered: