Add auto configuration option for example
This commit is contained in:
parent
6e85a82f42
commit
66858e4d1a
|
@ -13,8 +13,8 @@ struct Args {
|
|||
#[clap(long)]
|
||||
height: u32,
|
||||
|
||||
#[clap(long, default_value = "8")]
|
||||
skip: u32,
|
||||
#[clap(long)]
|
||||
skip: Option<u32>,
|
||||
}
|
||||
|
||||
// Example usage:
|
||||
|
@ -28,11 +28,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
height,
|
||||
skip,
|
||||
} = Args::parse();
|
||||
let mut encoder = Encoder::new(
|
||||
Components { x: 4, y: 3 },
|
||||
ImageBounds { width, height },
|
||||
skip,
|
||||
)?;
|
||||
|
||||
let mut encoder = if let Some(skip) = skip {
|
||||
Encoder::new(
|
||||
Components { x: 4, y: 3 },
|
||||
ImageBounds { width, height },
|
||||
skip,
|
||||
)?
|
||||
} else {
|
||||
Encoder::auto(ImageBounds { width, height })
|
||||
};
|
||||
|
||||
let mut stdin = std::io::stdin().lock();
|
||||
let mut buf = [0u8; 1024];
|
||||
|
|
Loading…
Reference in a new issue