From 49740091bf001b94894965f88d604f3c065a5541 Mon Sep 17 00:00:00 2001 From: Ralf Zerres Date: Thu, 31 Oct 2019 17:49:32 +0100 Subject: [PATCH] main.rs: testing verbose output Signed-off-by: Ralf Zerres --- src/main.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main.rs b/src/main.rs index 5e40485..9421288 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,9 @@ +/* advotracker infrastructure. + * + * Copyright 2019 Ralf Zerres + * SPDX-License-Identifier: 0BSD + */ + #[macro_use] extern crate clap; extern crate locales; @@ -37,6 +43,15 @@ fn main() { 3 | _ => println!("Don't be crazy"), } + // You can handle information about subcommands by requesting their matches by name + // (as below), requesting just the name used, or both at the same time + if let Some(matches) = matches.subcommand_matches("test") { + if matches.is_present("debug") { + println!("Printing debug info..."); + } else { + println!("Printing normally..."); + } + } // Starting the program logic let res = t!("main.start", lang);