Skip to content

Commit

Permalink
Extract subcommands into separate trait
Browse files Browse the repository at this point in the history
  • Loading branch information
CreepySkeleton committed Feb 8, 2020
1 parent 7acc922 commit 802ba1e
Show file tree
Hide file tree
Showing 10 changed files with 572 additions and 615 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ clap-rs.iml

# Auxiliary files
test-results.test
expanded.rs
clap_derive/expanded.rs
4 changes: 2 additions & 2 deletions clap_derive/examples/doc_comments.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! How to use doc comments in place of `help/long_help`.
use clap::Clap;
use clap::{Clap, Subcommand};

/// A basic example for the usage of doc comments as replacement
/// of the arguments `help`, `long_help`, `about` and `long_about`.
Expand Down Expand Up @@ -52,7 +52,7 @@ code) in the description:
sub_command: SubCommand,
}

#[derive(Clap, Debug)]
#[derive(Clap, Subcommand, Debug)]
#[clap()]
enum SubCommand {
/// The same rules described previously for flags. Are
Expand Down
5 changes: 1 addition & 4 deletions clap_derive/src/derives/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,7 @@ pub struct Attrs {
/// The output of a generation method is not only the stream of new tokens but also the attribute
/// information of the current element. These attribute information may contain valuable information
/// for any kind of child arguments.
pub struct GenOutput {
pub tokens: proc_macro2::TokenStream,
pub attrs: Attrs,
}
pub type GenOutput = (proc_macro2::TokenStream, Attrs);

impl Method {
pub fn new(name: Ident, args: TokenStream) -> Self {
Expand Down
Loading

0 comments on commit 802ba1e

Please sign in to comment.