Advertisement
symdrome

cli.rs

Sep 6th, 2023
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.82 KB | None | 0 0
  1. use clap::Parser;
  2.    
  3. #[derive(Parser)]
  4. #[command(name = "Audio Length")]
  5. #[command(author = "Fabio A <faraujo@almawave.con.br>")]
  6. #[command(version = "0.01")]
  7. #[command(about = "It takes the time in seconds of audio files in a directory and writes the results in a csv file.")]
  8. pub struct Cli {
  9.     #[arg(value_name = "client name")]
  10.     #[arg(required = true)]
  11.     pub op: Option<String>,
  12.     #[arg(short, value_name = "source audio directory")]
  13.     #[arg(default_value = ".")]
  14.     pub src: Option<String>,
  15.     #[arg(short, value_name = "save the csv file in...")]
  16.     #[arg(default_value = ".")]
  17.     pub dst: Option<String>,
  18. }
  19.  
  20. impl Cli {
  21.     pub fn new() -> Cli {
  22.         let arg = Cli::parse();
  23.         Cli {
  24.             src: arg.src,
  25.             dst: arg.dst,
  26.             op: arg.op,
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement