mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 15:27:16 +00:00
chore: Include fig in testing
This commit is contained in:
parent
d8b6016f57
commit
a61752a5d5
2 changed files with 60 additions and 36 deletions
|
@ -131,4 +131,5 @@ default-members = [
|
|||
".",
|
||||
"clap_derive",
|
||||
"clap_generate",
|
||||
"clap_generate_fig",
|
||||
]
|
||||
|
|
|
@ -7,6 +7,7 @@ fn build_app() -> App<'static> {
|
|||
|
||||
fn build_app_with_name(s: &'static str) -> App<'static> {
|
||||
App::new(s)
|
||||
.version("3.0")
|
||||
.about("Tests completions")
|
||||
.arg(
|
||||
Arg::new("file")
|
||||
|
@ -45,28 +46,28 @@ static FIG: &str = r#"const completion: Fig.Spec = {
|
|||
isOptional: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "--version",
|
||||
description: "Print version information",
|
||||
},
|
||||
{
|
||||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "help",
|
||||
description: "Print this message or the help of the given subcommand(s)",
|
||||
options: [
|
||||
{
|
||||
name: "--version",
|
||||
description: "Print version information",
|
||||
},
|
||||
{
|
||||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -75,6 +76,10 @@ static FIG: &str = r#"const completion: Fig.Spec = {
|
|||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
],
|
||||
args: {
|
||||
name: "file",
|
||||
|
@ -121,14 +126,14 @@ static FIG_SPECIAL_CMDS: &str = r#"const completion: Fig.Spec = {
|
|||
isOptional: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "--version",
|
||||
description: "Print version information",
|
||||
},
|
||||
{
|
||||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -143,41 +148,41 @@ static FIG_SPECIAL_CMDS: &str = r#"const completion: Fig.Spec = {
|
|||
isOptional: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "--version",
|
||||
description: "Print version information",
|
||||
},
|
||||
{
|
||||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "some-cmd-with-hypens",
|
||||
options: [
|
||||
{
|
||||
name: "--version",
|
||||
description: "Print version information",
|
||||
},
|
||||
{
|
||||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "help",
|
||||
description: "Print this message or the help of the given subcommand(s)",
|
||||
options: [
|
||||
{
|
||||
name: "--version",
|
||||
description: "Print version information",
|
||||
},
|
||||
{
|
||||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -186,6 +191,10 @@ static FIG_SPECIAL_CMDS: &str = r#"const completion: Fig.Spec = {
|
|||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
],
|
||||
args: {
|
||||
name: "file",
|
||||
|
@ -205,6 +214,7 @@ fn fig_with_special_help() {
|
|||
|
||||
fn build_app_special_help() -> App<'static> {
|
||||
App::new("my_app")
|
||||
.version("3.0")
|
||||
.arg(
|
||||
Arg::new("single-quotes")
|
||||
.long("single-quotes")
|
||||
|
@ -241,6 +251,10 @@ static FIG_SPECIAL_HELP: &str = r#"const completion: Fig.Spec = {
|
|||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
{
|
||||
name: "--single-quotes",
|
||||
description: "Can be 'always', 'auto', or 'never'",
|
||||
|
@ -279,6 +293,7 @@ fn fig_with_aliases() {
|
|||
|
||||
fn build_app_with_aliases() -> App<'static> {
|
||||
App::new("cmd")
|
||||
.version("3.0")
|
||||
.about("testing bash completions")
|
||||
.arg(
|
||||
Arg::new("flag")
|
||||
|
@ -316,6 +331,10 @@ static FIG_ALIASES: &str = r#"const completion: Fig.Spec = {
|
|||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
{
|
||||
name: ["-f", "-F", "--flag", "--flg"],
|
||||
description: "cmd flag",
|
||||
|
@ -367,14 +386,14 @@ static FIG_SUB_SUBCMDS: &str = r#"const completion: Fig.Spec = {
|
|||
isOptional: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "--version",
|
||||
description: "Print version information",
|
||||
},
|
||||
{
|
||||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -405,28 +424,28 @@ static FIG_SUB_SUBCMDS: &str = r#"const completion: Fig.Spec = {
|
|||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: "--version",
|
||||
description: "Print version information",
|
||||
},
|
||||
{
|
||||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "help",
|
||||
description: "Print this message or the help of the given subcommand(s)",
|
||||
options: [
|
||||
{
|
||||
name: "--version",
|
||||
description: "Print version information",
|
||||
},
|
||||
{
|
||||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -435,6 +454,10 @@ static FIG_SUB_SUBCMDS: &str = r#"const completion: Fig.Spec = {
|
|||
name: ["-h", "--help"],
|
||||
description: "Print help information",
|
||||
},
|
||||
{
|
||||
name: ["-V", "--version"],
|
||||
description: "Print version information",
|
||||
},
|
||||
],
|
||||
args: {
|
||||
name: "file",
|
||||
|
|
Loading…
Add table
Reference in a new issue