-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(YAML): allows building a CLI from YAML files
- Loading branch information
Showing
7 changed files
with
283 additions
and
41 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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: claptests | ||
version: 1.0 | ||
about: tests clap library | ||
author: Kevin K. <[email protected]> | ||
args: | ||
- opt: | ||
short: o | ||
long: option | ||
multiple: true | ||
help: tests options | ||
- positional: | ||
help: tests positionals | ||
takes_value: true | ||
- positional2: | ||
help: tests positionals with exclusions | ||
takes_value: true | ||
- flag: | ||
short: f | ||
long: flag | ||
multiple: true | ||
help: tests flags | ||
global: true | ||
- flag2: | ||
short: F | ||
help: tests flags with exclusions | ||
conflicts_with: | ||
- flag | ||
requires: | ||
- option2 | ||
- option2: | ||
long: long-option-2 | ||
help: tests long options with exclusions | ||
conflicts_with: | ||
- option | ||
requires: | ||
- positional2 | ||
- option3: | ||
short: O | ||
long: Option | ||
help: tests options with specific value sets | ||
takes_value: true | ||
possible_values: | ||
- fast | ||
- slow | ||
- positional3: | ||
takes_value: true | ||
help: tests positionals with specific values | ||
possible_values: [ vi, emacs ] | ||
- multvals: | ||
long: multvals | ||
help: Tests mutliple values, not mult occs | ||
value_names: | ||
- one | ||
- two | ||
- multvalsmo: | ||
long: multvalsmo | ||
multiple: true | ||
help: Tests mutliple values, not mult occs | ||
value_names: [one, two] | ||
- minvals2: | ||
long: minvals2 | ||
multiple: true | ||
help: Tests 2 min vals | ||
min_values: 2 | ||
- maxvals3: | ||
long: maxvals3 | ||
multiple: true | ||
help: Tests 3 max vals | ||
max_values: 3 | ||
subcommands: | ||
- subcmd: | ||
about: tests subcommands | ||
version: 0.1 | ||
author: Kevin K. <[email protected]> | ||
args: | ||
- scoption: | ||
short: o | ||
long: option | ||
multiple: true | ||
help: tests options | ||
takes_value: true | ||
- scpositional: | ||
help: tests positionals | ||
takes_value: true |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#[macro_use] | ||
extern crate clap; | ||
|
||
use clap::App; | ||
|
||
#[test] | ||
#[cfg(feature="yaml")] | ||
fn create_app_from_yaml() { | ||
let yml = load_yaml!("app.yml"); | ||
App::from_yaml(yml); | ||
} |