dolltool/src/main.rs

55 lines
1.5 KiB
Rust

/*
* Copyright (C) 2026 ika4422
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
mod commands;
mod dollcode;
mod models;
mod pattern_gen;
use std::process;
use clap::Parser;
use crate::models::Args;
fn main() {
let args = Args::parse();
if args.license {
println!("{}", include_str!("../LICENSE"));
process::exit(0);
}
if args.tokens {
println!("{}", pattern_gen::TOKEN_HELP);
process::exit(0);
}
if let Some(pattern) = args.generate {
commands::run_generate(
&pattern,
args.count,
args.base.radix(),
args.no_doll,
args.text,
);
} else if let Some(input) = args.encode {
commands::run_encode(&input, args.base.radix(), args.text);
} else if let Some(input) = args.decode {
commands::run_decode(&input, args.base.radix(), args.text);
}
}