Title: Managing location stacks via the *-Location cmdlets lacks ability to clear stacks · Issue #4643 · PowerShell/PowerShell · GitHub
Open Graph Title: Managing location stacks via the *-Location cmdlets lacks ability to clear stacks · Issue #4643 · PowerShell/PowerShell
X Title: Managing location stacks via the *-Location cmdlets lacks ability to clear stacks · Issue #4643 · PowerShell/PowerShell
Description: Location history for use with Push-Location and Pop-Location can be kept in separate history stacks, if desired. These stacks cannot be managed directly; they are indirectly managed via the *-Location cmdlets. You indirectly create a sta...
Open Graph Description: Location history for use with Push-Location and Pop-Location can be kept in separate history stacks, if desired. These stacks cannot be managed directly; they are indirectly managed via the *-Locat...
X Description: Location history for use with Push-Location and Pop-Location can be kept in separate history stacks, if desired. These stacks cannot be managed directly; they are indirectly managed via the *-Locat...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/4643
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Managing location stacks via the *-Location cmdlets lacks ability to clear stacks","articleBody":"Location history for use with `Push-Location` and `Pop-Location` can be kept in separate history _stacks_, if desired.\r\n\r\nThese stacks cannot be managed directly; they are indirectly managed via the `*-Location` cmdlets.\r\n\r\n* You indirectly _create_ a stack with `Push-Location -StackName \u003cname>`.\r\n* Once created, further locations can be pushed and popped.\r\n* `Set-Location -StackName \u003cname>` can be used to make a given stack the current stack.\r\n* `Get-Location -Stack [-StackName \u003cname>]` returns the locations currently stored in the active / given stack.\r\n\r\nHowever, there is currently no way to _clear_ a stack (other than by popping off all items through repeated `Pop-Location` calls).\r\n\r\nClearing a stack is desirable if you want to make sure that it is _empty_ before you use it - either to reuse a previously used stack or in cases where previously executed code may have created a stack by the same name.\r\n\r\nSecondarily,\r\n\r\n* there's also no way to _delete_ a stack, although, arguably, the ability to _clear_ stacks is enough.\r\n\r\n* there's no _test_ whether a stack with a given name _exists_, other than letting `Get-Location -StackName \u003cname>` _fail_; arguably, rather than worrying about explicit existence / deletion of stacks, letting `Get-Location -Stack -StackName \u003cname>` return _nothing_ (the null collection) for a nonexistent stack is preferable, given that `Get-Location -Stack` with the _unnamed_ stack already works that way.\r\n\r\nAs an aside: While calling the `.Clear()` _method_ on the stack object that `Get-Location -Stack` returns may seem like a workaround for the current inability to clear a stack using cmdlets, it doesn't actually work (only clears the object returned, not the actual stack); more importantly, `Get-Location -Stack` should arguably return an array of location paths rather than a scalar stack \r\nobject - see ##4642.\r\n\r\nEnvironment data\r\n----------------\r\n\r\n```powershell\r\nPowerShell Core v6.0.0-beta.5\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2017-08-22T17:31:25Z","url":"https://github.com/PowerShell/PowerShell/issues/4643"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5d025ede-da41-61d9-f827-f0e484712823 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9594:4C46A:76A4EF:AB10F9:6AFD8025 |
| html-safe-nonce | cffe9af49c45195a7526183637295de90395e2caa7d72096eda4cc0f19780e79 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTk0OjRDNDZBOjc2QTRFRjpBQjEwRjk6NkFGRDgwMjUiLCJ2aXNpdG9yX2lkIjoiMzQwNzUzMjI0NzMzMzMwNjQwNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 03f8b5ea83f7723074609c26d948bb13674da12f40ec40a18a16f783710053c0 |
| hovercard-subject-tag | issue:252032946 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/4643/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7fb9c7c21c1ce9f51285eeec5c7bf137f7efe16a03429943cf1d6029b15975fc/PowerShell/PowerShell/issues/4643 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7fb9c7c21c1ce9f51285eeec5c7bf137f7efe16a03429943cf1d6029b15975fc/PowerShell/PowerShell/issues/4643 |
| og:image:alt | Location history for use with Push-Location and Pop-Location can be kept in separate history stacks, if desired. These stacks cannot be managed directly; they are indirectly managed via the *-Locat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42d4967e3c8afca51ccac31f419a705af777226a95f025ea73387d87a306b326 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2329ceed0bc2c7b7c3b9f5f2db6abfc7b6fc3a50 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width