-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29f12aa
commit 0c01ddd
Showing
4 changed files
with
83 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use clap::Subcommand; | ||
|
||
mod assemble; | ||
mod initialize; | ||
|
||
#[derive(Subcommand)] | ||
pub(crate) enum Commands { | ||
Assemble(assemble::Assemble), | ||
Initialize(initialize::Initialize), | ||
} | ||
|
||
trait CommandExecutor { | ||
fn execute(&self); | ||
} | ||
|
||
pub(crate) fn execute_command(command: Commands) { | ||
match command { | ||
Commands::Assemble(a) => a.execute(), | ||
Commands::Initialize(a) => a.execute(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use std::path::PathBuf; | ||
|
||
use clap::Args; | ||
use log::{debug, trace}; | ||
|
||
use super::CommandExecutor; | ||
|
||
#[derive(Args)] | ||
/// Assembles a powerd6 module from a directory | ||
pub(crate) struct Assemble { | ||
/// The path of the directory to be assembled | ||
#[arg(short, long, default_value = "./")] | ||
pub(crate) config: PathBuf, | ||
} | ||
|
||
impl CommandExecutor for Assemble { | ||
fn execute(&self) { | ||
trace!("Executing assemble"); | ||
debug!("Open config directory: {:?}", self.config); | ||
debug!("Assemble module information"); | ||
debug!("Assemble authors information"); | ||
debug!("Assemble schema information"); | ||
debug!("Assemble contents information"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use std::path::PathBuf; | ||
|
||
use clap::Args; | ||
use log::{debug, trace}; | ||
|
||
use super::CommandExecutor; | ||
|
||
#[derive(Args)] | ||
/// Initializes a directory for a powerd6 module | ||
pub(crate) struct Initialize { | ||
/// The path of the directory to be initialized | ||
#[arg(short, long, default_value = "./")] | ||
pub(crate) config: PathBuf, | ||
} | ||
|
||
impl CommandExecutor for Initialize { | ||
fn execute(&self) { | ||
trace!("Executing initialize"); | ||
debug!( | ||
"Create config directory if not exists: {:?}", | ||
self.config | ||
); | ||
debug!("Create module.yaml"); | ||
debug!("Create authors directory"); | ||
debug!("Create schema directory"); | ||
debug!("Create contents directory"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters