-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
15: Support multiline doc comments r=matklad a=thomcc Previously these didn't work, and it was kind of annoying trying to describe things in one line. The fix is pretty simple, most of the diff is from extending tests/it/help and regenerating it. I thought about trying to either mirror the logic [structopt](https://github.com/TeXitoi/structopt/blob/d16cfd264d3173fe64a883dea67e9975dc7bbb2d/structopt-derive/src/doc_comments.rs#L1) or [rustdoc](https://github.com/rust-lang/rust/blob/6c2dd251bbff03c7a3092d43fb5b637eca0810e3/compiler/rustc_ast/src/util/comments.rs#L28) use... but it gets pretty convoluted. I figure for terminal output this doesn't matter that much. Also it's easier just to preserve the way the user formatted it for now, and that gets 90% of there anyway, so long as people don't use multiline comments (which you can just not use here, if you're in the minority of rust users who prefer them). This also ensures stuff like markdown lists stay formatted, which is a problem with structopt's approach. I had to re-enable the `help` "test" (I dont think it's used to test anything, aside from somethign perhaps that the output matches? I wasn't sure how to test beyond that, but I did make sure to update it, so you can see the results here. I also fixed a minor issue with how your xtask prints its help message. (This is entirely unrelated, admittedly) Co-authored-by: Thom Chiovoloni <[email protected]>
- Loading branch information
Showing
8 changed files
with
74 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
mod repeated_pos; | ||
mod smoke; | ||
mod subcommands; | ||
mod help; | ||
|
||
use std::{ffi::OsString, fmt}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
xflags! { | ||
/// Does stuff | ||
/// | ||
/// Helpful stuff. | ||
cmd helpful | ||
/// With an arg. | ||
optional src: PathBut | ||
optional src: PathBuf | ||
/// Another arg. | ||
/// | ||
/// This time, we provide some extra info about the | ||
/// arg. Maybe some caveats, or what kinds of | ||
/// values are accepted. | ||
optional extra: String | ||
{ | ||
/// And a switch. | ||
required -s, --switch | ||
|
||
/// And even a subcommand! | ||
cmd sub { | ||
/// With an optional flag. This has a really long | ||
/// description which spans multiple lines. | ||
optional -f, --flag | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters