DanielKeep / cargo-script

Cargo script subcommand
Other
729 stars 37 forks source link

Commas cause -e to mangle the expression #28

Closed durka closed 7 years ago

durka commented 8 years ago
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.

kbknapp commented 8 years ago

cc https://github.com/kbknapp/clap-rs/issues/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 8 years ago

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

bluss commented 7 years ago

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