File: example-wifi.rs

package info (click to toggle)
rust-qr2term 0.3.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 184 kB
  • sloc: makefile: 2
file content (18 lines) | stat: -rw-r--r-- 632 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
fn main() {
    println!("WiFi network name: ");
    let wifi_network = std::io::stdin().lines().next().unwrap().unwrap();
    println!("\nPassword: ");
    let pass = std::io::stdin().lines().next().unwrap().unwrap();
    println!("\nType (WEP or [WPA - hit Enter as default]): ");
    let _network_type = std::io::stdin().lines().next().unwrap().unwrap();
    let network_type = if _network_type.is_empty() {
        "WPA".to_string()
    } else {
        _network_type
    };

    let input =
        "WIFI:S:".to_string() + &wifi_network + ";T:" + &network_type + ";P:" + &pass + ";;";

    qr2term::print_qr(input).unwrap();
}