Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,17 @@
name: myapp
version: "1.0"
author: A Rust Developer <rustme@home.com>
about: Does awesome things
args:
- STRING1:
about: First string to use
required: true
index: 1
- STRING2:
about: Second string to use
required: true
index: 2
- SEPARATOR:
about: Separtor to use
required: true
index: 3

View file

@ -0,0 +1,2 @@
[dependencies]
clap = { version = "3.0.0-beta.2", features = ["yaml"] }

View file

@ -0,0 +1,17 @@
#[macro_use]
extern crate clap;
use clap::App;
fn main() {
let yaml = load_yaml!("cli.yaml");
let matches = App::from(yaml).get_matches();
let str1 = matches.value_of("STRING1").unwrap();
let str2 = matches.value_of("STRING2").unwrap();
let str3 = matches.value_of("SEPARATOR").unwrap();
println!("{:?}", f(&str1, &str2, &str3));
}
fn f<'a>(s1: &'a str, s2: &'a str, sep :&'a str) -> String{
[s1,sep,sep,s2].iter().map(|x| *x).collect()
}