pub fn from_env<T: TopLevelCommand>() -> T {
	const NAME: &str = env!("CARGO_BIN_NAME");
	const VERSION: &str = env!("CARGO_PKG_VERSION");
	let args: Vec<String> = std::env::args().collect();
	let cmd = Path::new(&args[0])
		.file_name()
		.and_then(|s| s.to_str())
		.unwrap_or(&args[0]);
	let args_str: Vec<&str> = args.iter().map(|s| s.as_str()).collect();
	T::from_args(&[cmd], &args_str[1..]).unwrap_or_else(|early_exit| {
		println!("{} {}\n", NAME, VERSION);
		println!("{}", early_exit.output);
		std::process::exit(match early_exit.status {
			Ok(()) => 0,
			Err(()) => 1,
		})
	})
}
/// copy of argh::from_env to insert command name and version in help text
copy of argh::from_env to insert command name and version in help text
copy of argh :: from_env to insert command name and version in help text
pub fn from_env<T: TopLevelCommand>() -> T {
	const NAME: &str = env!("CARGO_BIN_NAME");
	const VERSION: &str = env!("CARGO_PKG_VERSION");
	let args: Vec<String> = std::env::args().collect();
	let cmd = Path::new(&args[0])
		.file_name()
		.and_then(|s| s.to_str())
		.unwrap_or(&args[0]);
	let args_str: Vec<&str> = args.iter().map(|s| s.as_str()).collect();
	T::from_args(&[cmd], &args_str[1..]).unwrap_or_else(|early_exit| {
		println!("{} {}\n", NAME, VERSION);
		println!("{}", early_exit.output);
		std::process::exit(match early_exit.status {
			Ok(()) => 0,
			Err(()) => 1,
		})
	})
}
pub fn from_env < T : TopLevelCommand > ( ) -> T { const NAME : & str = env ! ( " " ) ; const VERSION : & str = env ! ( " " ) ; let args : Vec < String > = std :: env :: args ( ) . collect ( ) ; let cmd = Path :: new ( & args [ 0 ] ) . file_name ( ) . and_then ( | s | s . to_str ( ) ) . unwrap_or ( & args [ 0 ] ) ; let args_str : Vec < & str > = args . iter ( ) . map ( | s | s . as_str ( ) ) . collect ( ) ; T :: from_args ( & [ cmd ] , & args_str [ 1 .. ] ) . unwrap_or_else ( | early_exit | { println ! ( " \n " NAME VERSION ) ; println ! ( " " early_exit output ) ; std :: process :: exit ( match early_exit . status { Ok ( ( ) ) => 0 , Err ( ( ) ) => 1 , } ) } ) }
copy of argh::from_env to insert command name and version in help text
copy of argh :: from_env to insert command name and version in help text