Skip to content

Introduce #[structopt(external_subcommand)]#314

Merged
CreepySkeleton merged 3 commits into
masterfrom
external_subcommand
Jan 18, 2020
Merged

Introduce #[structopt(external_subcommand)]#314
CreepySkeleton merged 3 commits into
masterfrom
external_subcommand

Conversation

@CreepySkeleton

@CreepySkeleton CreepySkeleton commented Dec 22, 2019

Copy link
Copy Markdown
Collaborator

Closes #130

I took some time to develop and debug, but it's finally ready. I have one concern thought.

Comment thread tests/subcommands.rs
@CreepySkeleton

Copy link
Copy Markdown
Collaborator Author

Sorry for the radio silence, the New Year and all :)

This is not abandoned, I'll get to it in 1-2 days.

Comment on lines +1 to +8
error[E0308]: mismatched types
--> $DIR/external_subcommand_wrong_type.rs:13:15
|
13 | Other(Vec<CString>)
| ^^^^^^^ expected struct `std::ffi::CString`, found struct `std::ffi::OsString`
|
= note: expected type `std::vec::Vec<std::ffi::CString>`
found type `std::vec::Vec<std::ffi::OsString>`

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message is rather unfortunate: I would very much like it to say "expected OsString", but there's nothing we can do about it 😢

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the best I've managed to come up with:

error[E0308]: mismatched types
  --> $DIR/external_subcommand_wrong_type.rs:13:15
   |
13 |     Other(Vec<CString>)
   |               ^^^^^^^ expected struct `std::ffi::CString`, found struct `std::ffi::OsString`
   |
   = note: expected type `std::vec::Vec<std::ffi::CString>`
              found type `std::vec::Vec<std::ffi::OsString>`

error[E0308]: mismatched types
  --> $DIR/external_subcommand_wrong_type.rs:13:15
   |
13 |     Other(Vec<CString>)
   |               ^^^^^^^
   |               |
   |               expected struct `std::ffi::OsString`, found struct `std::ffi::CString`
   |               this match expression has type `std::vec::Vec<std::ffi::OsString>`
   |
   = note: expected type `std::vec::Vec<std::ffi::OsString>`
              found type `std::vec::Vec<std::ffi::CString>`

While it is indeed possible to draw the error message we desire, I can't get rid of the first one.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's acceptable

@CreepySkeleton

Copy link
Copy Markdown
Collaborator Author

OK, ready to go

@CreepySkeleton

Copy link
Copy Markdown
Collaborator Author

ping @TeXitoi

@TeXitoi TeXitoi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use of AllowExternalSubcommands

2 participants