[dcb-dbg] Renamed cli to args and CliData to Args.

This commit is contained in:
Filipe Rodrigues 2021-08-13 14:57:24 +01:00
parent a7133fb7db
commit 6cd572ee0f
2 changed files with 9 additions and 8 deletions

View File

@ -4,9 +4,9 @@
use clap::{App as ClapApp, Arg as ClapArg}; use clap::{App as ClapApp, Arg as ClapArg};
use std::path::PathBuf; use std::path::PathBuf;
/// Command line data /// Arguments
#[derive(PartialEq, Clone, Debug)] #[derive(PartialEq, Clone, Debug)]
pub struct CliData { pub struct Args {
/// The input file /// The input file
pub input_path: PathBuf, pub input_path: PathBuf,
@ -14,8 +14,8 @@ pub struct CliData {
pub header_path: PathBuf, pub header_path: PathBuf,
} }
impl CliData { impl Args {
/// Constructs all of the cli data given and returns it /// Returns all arguments
pub fn new() -> Self { pub fn new() -> Self {
const INPUT_FILE_STR: &str = "input-file"; const INPUT_FILE_STR: &str = "input-file";
const HEADER_FILE_STR: &str = "header-file"; const HEADER_FILE_STR: &str = "header-file";

View File

@ -3,9 +3,10 @@
#![feature(try_blocks, format_args_capture, iter_map_while, box_syntax)] #![feature(try_blocks, format_args_capture, iter_map_while, box_syntax)]
// Modules // Modules
mod cli; mod args;
// Imports // Imports
use crate::args::Args;
use anyhow::Context; use anyhow::Context;
use byteorder::{ByteOrder, LittleEndian}; use byteorder::{ByteOrder, LittleEndian};
use dcb_exe::{ use dcb_exe::{
@ -31,11 +32,11 @@ fn main() -> Result<(), anyhow::Error> {
) )
.expect("Unable to initialize logger"); .expect("Unable to initialize logger");
// Get all data from cli // Get all arguments
let cli = cli::CliData::new(); let args = Args::new();
// Open the input file // Open the input file
let input_bytes = fs::read(&cli.input_path).context("Unable to read input file")?; let input_bytes = fs::read(&args.input_path).context("Unable to read input file")?;
// Then put them at `0x10000` // Then put them at `0x10000`
let mut memory = vec![0; 0x10000]; let mut memory = vec![0; 0x10000];