DanielKeep/cargo-script

Commas cause -e to mangle the expression

durka opened this issue · 3 comments

durka commented
alexs-air-3:rust alex$ cargo script -e '[1, 2]'
   Compiling expr v0.1.0 (file:///Users/alex/.multirust/toolchains/beta/cargo/.cargo/script-cache/expr-68f9e2ff5dd19fe8)
error: incorrect close delimiter: `}`
 --> /Users/alex/.multirust/toolchains/beta/cargo/.cargo/script-cache/expr-68f9e2ff5dd19fe8/expr.rs:5:4
  |
5 | {[1}
  |    ^
  |
note: unclosed delimiter
 --> /Users/alex/.multirust/toolchains/beta/cargo/.cargo/script-cache/expr-68f9e2ff5dd19fe8/expr.rs:5:2
  |
5 | {[1}
  |  ^

error: aborting due to previous error

error: Could not compile `expr`.

I believe this is clap's fault; you need to call use_delimiter(false) somewhere.

cc clap-rs/clap#655

Setting use_delimiter(false) will fix this, but I'm working to keep this from being an issue in the future as well.

durka commented

@kbknapp you are quick! I'll submit a PR with the workaround anyway. It does seem like a poor default.

bluss commented

oh, this is the case of the "weird failure" I mentioned over in #35