Title: Parameter parsing/passing: unquoted tokens that look like named arguments with colon as the separator are broken in two when passed indirectly via $Args / @Args · Issue #6360 · PowerShell/PowerShell · GitHub
Open Graph Title: Parameter parsing/passing: unquoted tokens that look like named arguments with colon as the separator are broken in two when passed indirectly via $Args / @Args · Issue #6360 · PowerShell/PowerShell
X Title: Parameter parsing/passing: unquoted tokens that look like named arguments with colon as the separator are broken in two when passed indirectly via $Args / @Args · Issue #6360 · PowerShell/PowerShell
Description: Related: #6291, #6292, and #4624 Following up from #6292 (comment): Note: The tokens in question, such as -foo:bar, look like named PowerShell arguments (and, behind the scenes, are initially always parsed as such - see Bruce Payette (@B...
Open Graph Description: Related: #6291, #6292, and #4624 Following up from #6292 (comment): Note: The tokens in question, such as -foo:bar, look like named PowerShell arguments (and, behind the scenes, are initially alway...
X Description: Related: #6291, #6292, and #4624 Following up from #6292 (comment): Note: The tokens in question, such as -foo:bar, look like named PowerShell arguments (and, behind the scenes, are initially alway...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/6360
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Parameter parsing/passing: unquoted tokens that look like named arguments with colon as the separator are broken in two when passed indirectly via $Args / @Args","articleBody":"\u003csup>Related: #6291, #6292, and #4624\u003c/sup>\r\n\r\nFollowing up from https://github.com/PowerShell/PowerShell/issues/6292#issuecomment-371344550:\r\n\r\nNote: The tokens in question, such as **`-foo:bar`, _look_ like named PowerShell arguments** (and, behind the scenes, are initially always parsed as such - see @BrucePay's comment below), but **should be passed through as-is (except for possibly expanding the string) when calling external programs.**\r\n\r\nTokens that happen to look like **`-foo.bar`** suffer a similar fate (see #6291).\r\n\r\nThis **already works as expected with _direct_ argument passing** (e.g., \r\n`echoArgs -foo:bar` passes `-foo:bar` as a single argument\r\n), but **not when passing `$Args` / splatting it (`@Args`).**\r\n\r\nNote: The problem is fundamental to the use of `$Args` / `@Args` and, while perhaps less common, also affects its use when calling PowerShell-native commands - see [comment below](https://github.com/PowerShell/PowerShell/issues/6360#issuecomment-375972209).\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\nRun on macOS or Linux.\r\n\r\n```powershell\r\nfunction baz {\r\n bash -c 'for a; do echo $a; done' - $Args # note: same with @Args\r\n}\r\n\r\nbaz -foo:bar\r\n'---'\r\nbaz -foo.bar\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\n```none\r\n-foo:bar\r\n---\r\n-foo.bar\r\n```\r\n\r\nActual behavior\r\n---------------\r\n\r\n```none\r\n-foo:\r\nbar\r\n---\r\n-foo\r\n.bar\r\n```\r\n\r\nThe arguments are unexpectedly broken in two. See linked comment for background.\r\n\r\n\r\n\r\n\r\nEnvironment data\r\n----------------\r\n\r\n```powershell\r\nPowerShell Core v6.0.1 on macOS 10.13.3\r\nPowerShell Core v6.0.1 on Ubuntu 16.04.3 LTS\r\nPowerShell Core v6.0.1 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)\r\nWindows PowerShell v5.1.15063.674 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2018-03-11T07:52:49Z","url":"https://github.com/PowerShell/PowerShell/issues/6360"}
| 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:61fecf5c-857c-a70c-7b31-ebaff1aecec8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 965E:8C4AA:11FAB6:18825C:6AFD4C73 |
| html-safe-nonce | 9fc43226e661af1c1487a628696a286ae499db02833691e19482dd202294d38d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjVFOjhDNEFBOjExRkFCNjoxODgyNUM6NkFGRDRDNzMiLCJ2aXNpdG9yX2lkIjoiNTQ5Mjg1MDYwNzQxMDQ2NTkwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7fd6deb93bbbd09a532da5d06d4afb7d581eff9f4b9d0102735ee3ea8c3b3c53 |
| hovercard-subject-tag | issue:304138228 |
| 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/6360/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cc14aba187be0a4b95e0fe1b20de401edf72bf7a8ba5a09629a907113f5e0794/PowerShell/PowerShell/issues/6360 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cc14aba187be0a4b95e0fe1b20de401edf72bf7a8ba5a09629a907113f5e0794/PowerShell/PowerShell/issues/6360 |
| og:image:alt | Related: #6291, #6292, and #4624 Following up from #6292 (comment): Note: The tokens in question, such as -foo:bar, look like named PowerShell arguments (and, behind the scenes, are initially alway... |
| 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 | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| 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 | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width