kittv
/
prezgen
Archived
1
0
Fork 0

Expanded command line arguments, added `-h` text.

master
Dawid J. Kubis 3 years ago
parent 4caf57ca73
commit 87d354ab15

1
.gitignore vendored

@ -1,2 +1,3 @@
/target
*.swp
test.toml

@ -1,3 +1,39 @@
use structopt::StructOpt;
use toml::Value;
use std::path::PathBuf;
use std::fs::{read_to_string, copy};
#[derive(StructOpt, Debug)]
/// structure representing command line arguments
struct Opt {
#[structopt(name = "FILE")]
/// The input file.
/// It contains all the settings related to substitution
toml: PathBuf,
#[structopt(short, long, default_value = "output")]
/// Output directory.
output: PathBuf,
#[structopt(short, long)]
/// Template to be processed.
/// if a directory, then all the unspecified
/// files will be copied to the output as well.
template: PathBuf,
}
fn main() {
println!("Hello, world!");
// parse command line arguments
let opt = Opt::from_args();
//println!("{:?}", opt);
// parse toml
let value = read_to_string(opt.toml)
.unwrap()
.parse::<Value>()
.unwrap();
println!("{:?}", value);
}