40 lines
1.3 KiB
Rust
40 lines
1.3 KiB
Rust
extern crate clap;
|
|
extern crate tvrs;
|
|
|
|
use clap::{Arg, App, SubCommand};
|
|
use tvrs::MultiScreen;
|
|
|
|
fn main() {
|
|
|
|
let matches = App::new("tvrs")
|
|
.author("Thomas Forgione <thomas@forgione.fr>")
|
|
.version("0.1.0")
|
|
.arg(Arg::with_name("disable")
|
|
.help("Disable all screens except the primary")
|
|
.conflicts_with_all(&["enable", "duplicate"]))
|
|
.arg(Arg::with_name("duplicate")
|
|
.help("Duplicate the primary screen on the second one")
|
|
.conflicts_with_all(&["enable", "disable"]))
|
|
.arg(Arg::with_name("enable")
|
|
.help("Enable the second screen")
|
|
.requires("enable")
|
|
.conflicts_with_all(&["disable", "duplicate"]))
|
|
.arg(Arg::with_name("position")
|
|
.help("Specify the position of the second screen")
|
|
.possible_values(&["left", "right", "top", "bottom"]))
|
|
.get_matches();
|
|
|
|
let screens = MultiScreen::detect()
|
|
.expect("An error happened while finding screens");
|
|
|
|
|
|
if matches.is_present("disable") {
|
|
screens.only_primary()
|
|
.expect("An error happenned while executing the command");
|
|
} else if matches.is_present("duplicate") {
|
|
panic!("Not implemented yet");
|
|
} else if matches.is_present("enable") {
|
|
panic!("Not implemented yet");
|
|
}
|
|
}
|