mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
chore(derive): Ensure license is recorded for subcommand
This commit is contained in:
parent
7f08773a5a
commit
53a9802ab2
5 changed files with 46 additions and 0 deletions
|
@ -1,3 +1,16 @@
|
|||
// Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>,
|
||||
// Kevin Knapp (@kbknapp) <kbknapp@gmail.com>, and
|
||||
// Andrew Hobden (@hoverbear) <andrew@hoverbear.org>
|
||||
//
|
||||
// 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,
|
||||
|
|
9
clap_derive/tests/ui/enum_variant_not_args.rs
Normal file
9
clap_derive/tests/ui/enum_variant_not_args.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
#[derive(clap::Clap)]
|
||||
enum Opt {
|
||||
Sub(SubCmd),
|
||||
}
|
||||
|
||||
#[derive(clap::Clap)]
|
||||
enum SubCmd {}
|
||||
|
||||
fn main() {}
|
7
clap_derive/tests/ui/enum_variant_not_args.stderr
Normal file
7
clap_derive/tests/ui/enum_variant_not_args.stderr
Normal file
|
@ -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
clap_derive/tests/ui/flatten_on_subcommand.rs
Normal file
10
clap_derive/tests/ui/flatten_on_subcommand.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
#[derive(clap::Clap)]
|
||||
struct Opt {
|
||||
#[clap(flatten)]
|
||||
sub: SubCmd,
|
||||
}
|
||||
|
||||
#[derive(clap::Clap)]
|
||||
enum SubCmd {}
|
||||
|
||||
fn main() {}
|
7
clap_derive/tests/ui/flatten_on_subcommand.stderr
Normal file
7
clap_derive/tests/ui/flatten_on_subcommand.stderr
Normal file
|
@ -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`
|
Loading…
Reference in a new issue