Skip to content

Commit

Permalink
feat: ✨ Add generator command with clap
Browse files Browse the repository at this point in the history
  • Loading branch information
AntwortEinesLebens committed Nov 9, 2024
1 parent 998b1bf commit af304a4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later

use crate::traces::Traces;
use crate::{generator::Generator, traces::Traces};
use clap::{Parser, Subcommand};

#[derive(Debug, Parser)]
Expand All @@ -16,4 +16,5 @@ pub struct Arguments {
#[derive(Debug, Subcommand)]
pub enum Commands {
Traces(Traces),
Generator(Generator),
}
18 changes: 18 additions & 0 deletions src/generator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-FileCopyrightText: 2023 The MalwareTracesGenerator development team
//
// SPDX-License-Identifier: GPL-3.0-or-later

use clap::Parser;
use std::{error::Error, path::PathBuf};

#[derive(Debug, Parser)]
pub struct Generator {
#[clap(required = true, help = "Path to the configuration file")]
path: PathBuf,
}

impl Generator {
pub fn generate(&self) -> Result<(), Box<dyn Error>> {
Ok(())
}
}
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later

mod cli;
mod generator;
mod traces;
mod windows;

Expand All @@ -14,6 +15,7 @@ use traces::Runnable;
fn main() -> Result<(), Box<dyn Error>> {
match Arguments::parse().command {
Commands::Traces(action) => action.run()?,
Commands::Generator(generator) => generator.generate()?,
};

Ok(())
Expand Down

0 comments on commit af304a4

Please sign in to comment.