rustdoc
This commit is contained in:
14
src/cli.rs
14
src/cli.rs
@@ -1,3 +1,6 @@
|
||||
//! This module contains all functions related to the CLI part of the program.
|
||||
//!
|
||||
//! It manages and validates flags, mostly.
|
||||
use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
use std::process::exit;
|
||||
@@ -55,6 +58,9 @@ pub struct Cli {
|
||||
|
||||
|
||||
impl Cli {
|
||||
/// This function prints all parts of Cli.
|
||||
///
|
||||
/// used for debugging.
|
||||
pub fn debug_print(&self) {
|
||||
debug!("complex: {}", self.complex);
|
||||
debug!("colour: {}", self.colour);
|
||||
@@ -75,6 +81,13 @@ impl Cli {
|
||||
}
|
||||
}
|
||||
|
||||
/// This function validates various parts of Cli.
|
||||
///
|
||||
/// It checks that:
|
||||
/// * image exists
|
||||
/// * image has the proper extension
|
||||
/// * output file (if Some) does not exist
|
||||
/// * map (if Some) contains ASCII-only characters
|
||||
pub fn validate(&self) {
|
||||
if !file_exists(&self.image) {
|
||||
error!("Input file \"{}\" does not exist!", self.image.display());
|
||||
@@ -101,6 +114,7 @@ impl Cli {
|
||||
}
|
||||
}
|
||||
|
||||
/// This function initializes logging (dependent on cli.debug flag)
|
||||
pub fn init(&self) {
|
||||
if self.debug {std::env::set_var("RUST_LOG", "trace")}
|
||||
env_logger::init();
|
||||
|
||||
Reference in New Issue
Block a user