From 316fb11b4c8cd8eb322dcebbc8a89ba49977c6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 31 Dec 2017 20:25:31 +0100 Subject: [PATCH] Update CLI help --- README.md | 16 ++++++++-------- TODO.md | 3 ++- src/arg_handler.rs | 34 ++++++++++++++++++++++------------ src/color.rs | 2 +- src/image_manager.rs | 4 +++- src/painter/painter.rs | 8 ++++---- 6 files changed, 40 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index faaa078..bd3672f 100644 --- a/README.md +++ b/README.md @@ -83,20 +83,20 @@ Tim Visee A quick pixelflut client, that pwns pixelflut panels. USAGE: - pixelpwnr [OPTIONS] --images ... + pixelpwnr [OPTIONS] --image ... FLAGS: --help Prints help information -V, --version Prints version information OPTIONS: - -c, --count Number of simultanious threads (def: 4) - -r, --fps Frames per second with multiple images (def: 1) - -h, --height Drawing height in pixels (def: 1080) - -i, --images ... Paths of the images to print - -w, --width Drawing width in pixels (def: 1920) - -x, --x Drawing X offset in pixels (def: 0) - -y, --y Drawing Y offset in pixels (def: 0) + -i, --image ... Image paths + -w, --width Draw width (def: 1920) + -h, --height Draw height (def: 1080) + -x, --x Draw X offset (def: 0) + -y, --y Draw Y offset (def: 0) + -c, --count Number of concurrent threads (def: 4) + -r, --fps Frames per second with multiple images (def: 1) ARGS: The host to pwn "host:port" diff --git a/TODO.md b/TODO.md index 0ff4441..4386826 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,6 @@ # TODO -- Do not draw invisible pixels. +- Don't draw pixels outside screen. +- Do not draw invisible (alpha) pixels. - Read size from screen. - Instantly update images in painter threads, not just when the stopped drawing. diff --git a/src/arg_handler.rs b/src/arg_handler.rs index 75aa238..632d825 100644 --- a/src/arg_handler.rs +++ b/src/arg_handler.rs @@ -24,49 +24,59 @@ impl<'a: 'b, 'b> ArgHandler<'a> { .help("The host to pwn \"host:port\"") .required(true) .index(1)) - .arg(Arg::with_name("count") - .short("c") - .long("count") - .value_name("COUNT") - .help("Number of simultanious threads (def: 4)") - .takes_value(true)) .arg(Arg::with_name("image") .short("i") - .long("images") + .long("image") + .alias("images") .value_name("PATH") - .help("Paths of the images to print") + .help("Image paths") .required(true) .multiple(true) + .display_order(1) .takes_value(true)) .arg(Arg::with_name("width") .short("w") .long("width") .value_name("PIXELS") - .help("Drawing width in pixels (def: 1920)") + .help("Draw width ((def: 1920)") + .display_order(2) .takes_value(true)) .arg(Arg::with_name("height") .short("h") .long("height") .value_name("PIXELS") - .help("Drawing height in pixels (def: 1080)") + .help("Draw height (def: 1080)") + .display_order(3) .takes_value(true)) .arg(Arg::with_name("x") .short("x") .long("x") .value_name("PIXELS") - .help("Drawing X offset in pixels (def: 0)") + .help("Draw X offset(def: 0)") + .display_order(4) .takes_value(true)) .arg(Arg::with_name("y") .short("y") .long("y") .value_name("PIXELS") - .help("Drawing Y offset in pixels (def: 0)") + .help("Draw Y offset (def: 0)") + .display_order(5) + .takes_value(true)) + .arg(Arg::with_name("count") + .short("c") + .long("count") + .alias("thread") + .alias("threads") + .value_name("COUNT") + .help("Number of concurrent threads (def: 4)") + .display_order(6) .takes_value(true)) .arg(Arg::with_name("fps") .short("r") .long("fps") .value_name("RATE") .help("Frames per second with multiple images (def: 1)") + .display_order(7) .takes_value(true)) .get_matches(); diff --git a/src/color.rs b/src/color.rs index 09eec61..265ef4a 100644 --- a/src/color.rs +++ b/src/color.rs @@ -12,7 +12,7 @@ impl Color { /// Constructor. /// - /// The Red, Green and Blue values must be between 0 and 255. + /// The color channels must be between 0 and 255. pub fn from(r: u8, g: u8, b: u8) -> Color { Color { r, diff --git a/src/image_manager.rs b/src/image_manager.rs index c5169df..d5bc1e4 100644 --- a/src/image_manager.rs +++ b/src/image_manager.rs @@ -39,13 +39,15 @@ impl ImageManager { .collect() ); + // TODO: process the image slices + // We succeeded println!("All images have been loaded successfully"); image_manager } - /// Tick the image + /// Tick the image pub fn tick(&mut self, canvas: &mut Canvas) { // Get the image index bound let bound = self.images.len(); diff --git a/src/painter/painter.rs b/src/painter/painter.rs index 3a77b4a..79181f8 100644 --- a/src/painter/painter.rs +++ b/src/painter/painter.rs @@ -57,10 +57,10 @@ impl Painter { // Define the color let color = Color::from( - channels[0], - channels[1], - channels[2], - ); + channels[0], + channels[1], + channels[2], + ); // Set the pixel self.client.write_pixel(