Skip to content

Commit

Permalink
chore(derive): Ensure license is recorded for subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jul 15, 2021
1 parent 7f08773 commit 53a9802
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
13 changes: 13 additions & 0 deletions clap_derive/src/derives/subcommand.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// Copyright 2018 Guillaume Pinot (@TeXitoi) <[email protected]>,
// Kevin Knapp (@kbknapp) <[email protected]>, and
// Andrew Hobden (@hoverbear) <[email protected]>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//
// This work was derived from Structopt (https://github.com/TeXitoi/structopt)
// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
// MIT/Apache 2.0 license.
use crate::{
attrs::{Attrs, Kind, Name, DEFAULT_CASING, DEFAULT_ENV_CASING},
derives::args,
Expand Down
9 changes: 9 additions & 0 deletions clap_derive/tests/ui/enum_variant_not_args.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#[derive(clap::Clap)]
enum Opt {
Sub(SubCmd),
}

#[derive(clap::Clap)]
enum SubCmd {}

fn main() {}
7 changes: 7 additions & 0 deletions clap_derive/tests/ui/enum_variant_not_args.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
error[E0277]: the trait bound `SubCmd: clap::Args` is not satisfied
--> $DIR/enum_variant_not_args.rs:3:9
|
3 | Sub(SubCmd),
| ^^^^^^ the trait `clap::Args` is not implemented for `SubCmd`
|
= note: required by `augment_args`
10 changes: 10 additions & 0 deletions clap_derive/tests/ui/flatten_on_subcommand.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#[derive(clap::Clap)]
struct Opt {
#[clap(flatten)]
sub: SubCmd,
}

#[derive(clap::Clap)]
enum SubCmd {}

fn main() {}
7 changes: 7 additions & 0 deletions clap_derive/tests/ui/flatten_on_subcommand.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
error[E0277]: the trait bound `SubCmd: clap::Args` is not satisfied
--> $DIR/flatten_on_subcommand.rs:3:12
|
3 | #[clap(flatten)]
| ^^^^^^^ the trait `clap::Args` is not implemented for `SubCmd`
|
= note: required by `augment_args`

0 comments on commit 53a9802

Please sign in to comment.