Skip to content

Commit

Permalink
module structure
Browse files Browse the repository at this point in the history
  • Loading branch information
PlexSheep committed Feb 16, 2024
1 parent 660d4bd commit 2568d96
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl Debug for Config {
}

impl Config {
pub fn load(cli: Cli) -> Result<Self> {
pub fn load(cli: &Cli) -> Result<Self> {
let repo = match git2::Repository::open_from_env() {
Ok(repo) => repo,
Err(_err) => {
Expand Down Expand Up @@ -197,7 +197,7 @@ impl Config {
yaml,
repo,
path,
cli,
cli: cli.clone(),
})
}
}
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
pub mod changelog;
pub mod publish;
pub mod serverapi;
pub mod release;
pub mod config;
pub mod error;
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ use autocrate::{
cli::{Cli, Commands},
Config,
},
release::release,
publish::publish,
error::*,
};

#[tokio::main]
async fn main() -> Result<()> {
let cli = Cli::cli_parse();
let cfg = Config::load(cli.clone())?;
let cfg = Config::load(&cli)?;

match cli.command {
Commands::Changelog { .. } => {
println!("{}", Changelog::build(&cfg)?);
}
Commands::Release { .. } => {
todo!()
release(&cfg)?;
}
Commands::Publish { .. } => {
todo!()
publish(&cfg)?;
}
};
Ok(())
Expand Down
4 changes: 4 additions & 0 deletions src/publish/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
use crate::{config::Config, error::*};
pub fn publish(cfg: &Config) -> Result<()> {
todo!()
}
5 changes: 5 additions & 0 deletions src/release/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use crate::{config::Config, error::*};

pub fn release(cfg: &Config) -> Result<()> {
todo!()
}
Empty file added src/serverapi/mod.rs
Empty file.

0 comments on commit 2568d96

Please sign in to comment.