fix: Add newline after qr code and print usage if incorrect number of args passed
This commit is contained in:
parent
59a30b9d12
commit
6f0eac5a8c
|
@ -1,8 +1,12 @@
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let arg = env::args().nth(1).unwrap();
|
if env::args().len() == 2 {
|
||||||
let code = qrcode::QrCode::new(arg.as_bytes()).unwrap();
|
let arg = env::args().nth(1).unwrap();
|
||||||
|
let code = qrcode::QrCode::new(arg.as_bytes()).unwrap();
|
||||||
|
|
||||||
print!("{}", code.render().dark_color("\x1b[7m \x1b[0m").light_color("\x1b[49m \x1b[0m").build());
|
println!("{}", code.render().dark_color("\x1b[7m \x1b[0m").light_color("\x1b[49m \x1b[0m").build());
|
||||||
|
} else {
|
||||||
|
println!("Usage: {} INPUT_TEXT", env::args().nth(0).unwrap());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue