#[allow(non_camel_case_types)]
#[derive(Debug)]
pub struct ruSTLaOptions {
output_stream: OutputStream,
print_full_document: bool,
generate_class_file: bool
}
impl ruSTLaOptions {
pub fn new(args: &Vec<String>) -> Self {
let mut arg_index = 0usize;
let args_len = args.len();
let mut options = Self {
output_stream: OutputStream::StdOut,
print_full_document: false,
generate_class_file: false
};
while arg_index < args_len {
let arg = if let Some(arg) = args.get(arg_index) {
arg
} else {
break;
};
match arg.as_str() {
"--to-stdout" => options.output_stream = OutputStream::StdOut,
"--to-file" => options.output_stream = OutputStream::File,
"--full-doc" => options.print_full_document = true,
"--aplus-cls" => options.generate_class_file = true,
_ => {}
}
arg_index += 1;
}
options
}
pub fn shared_out_stream(&self) -> &OutputStream {
&self.output_stream
}
pub fn is_full_document(&self) -> bool {
self.print_full_document
}
pub fn create_class_file (&self) -> bool {
self.generate_class_file
}
}
#[derive(Debug)]
pub enum OutputStream {
StdOut,
File,
}