Print "verbose is true" if the flag -v was passed to the program command line, "verbose is false" otherwise.
use clap::{Arg, App};
let matches = App::new("My Program") .arg(Arg::with_name("verbose") .short("v") .takes_value(false)) .get_matches(); if matches.is_present("verbose") { println!("verbose is true") } else { println!("verbose is false") }
print("verbose is ${args.contains("-v")}");
import "flag"
var verbose = flag.Bool("v", false, "verbose") flag.Parse() fmt.Println("verbose is", *verbose)
const verbose = process.argv.includes('-v'); console.log('verbose is', verbose);
for i in paramcount do begin if paramstr(i)='-v' then begin verbose := true; break; end; writeln('verbose is ',verbose); end.
#!/usr/bin/perl -s use strict; use warnings; use vars qw($v); $v ||= 0; print 'verbose is ' . ($v ? 'true' : 'false') . "\n";
import argparse
parser = argparse.ArgumentParser() parser.add_argument('-v', action='store_true', dest='verbose') args = parser.parse_args() print('verbose is', args.verbose)
No security, no password. Other people might choose the same nickname.