clj-on-windows 2021-04-11

re: winget, I didn't realize winget was a Microsoft tool. might be worth pursueing

maybe, but not yet.

Is it a known issue that powershell splits command line args like this?

-foo:bar:bar
:args ("-foo:" "bar:bar")

Alex Miller (Clojure team) 2021-04-11T12:11:24.192400Z

Yeah, this is some “special” parsing they do

Only in the Windows powershell, not in the macOS Powershell. It's really special

This snippet from the powershell stuff seems to suggest so?

} elseif ($arg -ceq '-X:') {
      $Mode = "exec"
      $kw, $params = $params
      $ExecAliases = ":$kw"
      $ClojureArgs += $params
This makes command line arg parsing even more complex. Oh well.

So if I write the arg parsing in some general purpose programming language I have to detect "if invoked from powershell"? How do I do this?

or maybe just make a special rule that always is like: when passing args like -X: foo these args are considered together, even in bash?

might be a trade-off...

I'll only apply that workaround on Windows

or wait, powershell also works on linux and macos nowadays

On Windows PS:

bb -e '*command-line-args*' -X:foo:bar
("-X:" "foo:bar")
On macOS PS:
bb -e '*command-line-args*' -X:foo:bar
("-X:foo:bar")

Juxt checking: -A:, -M: and -X: are the only args that receive optional aliases appended to it, amirite?

according to the help yes. duckie

I wonder if the clojure CLI for Windows works on macOS powershell, but I'm not going there...

I expect the above edge case to break it