module structure
cargo devel CI / cargo CI (push) Successful in 3m34s Details

This commit is contained in:
Christoph J. Scherr 2024-02-16 18:58:20 +01:00
parent 660d4bd9da
commit 2568d96ac3
Signed by: PlexSheep
GPG Key ID: 7CDD0B14851A08EF
6 changed files with 19 additions and 5 deletions

View File

@ -156,7 +156,7 @@ impl Debug for Config {
} }
impl 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() { let repo = match git2::Repository::open_from_env() {
Ok(repo) => repo, Ok(repo) => repo,
Err(_err) => { Err(_err) => {
@ -197,7 +197,7 @@ impl Config {
yaml, yaml,
repo, repo,
path, path,
cli, cli: cli.clone(),
}) })
} }
} }

View File

@ -1,3 +1,6 @@
pub mod changelog; pub mod changelog;
pub mod publish;
pub mod serverapi;
pub mod release;
pub mod config; pub mod config;
pub mod error; pub mod error;

View File

@ -4,23 +4,25 @@ use autocrate::{
cli::{Cli, Commands}, cli::{Cli, Commands},
Config, Config,
}, },
release::release,
publish::publish,
error::*, error::*,
}; };
#[tokio::main] #[tokio::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {
let cli = Cli::cli_parse(); let cli = Cli::cli_parse();
let cfg = Config::load(cli.clone())?; let cfg = Config::load(&cli)?;
match cli.command { match cli.command {
Commands::Changelog { .. } => { Commands::Changelog { .. } => {
println!("{}", Changelog::build(&cfg)?); println!("{}", Changelog::build(&cfg)?);
} }
Commands::Release { .. } => { Commands::Release { .. } => {
todo!() release(&cfg)?;
} }
Commands::Publish { .. } => { Commands::Publish { .. } => {
todo!() publish(&cfg)?;
} }
}; };
Ok(()) Ok(())

4
src/publish/mod.rs Normal file
View File

@ -0,0 +1,4 @@
use crate::{config::Config, error::*};
pub fn publish(cfg: &Config) -> Result<()> {
todo!()
}

5
src/release/mod.rs Normal file
View File

@ -0,0 +1,5 @@
use crate::{config::Config, error::*};
pub fn release(cfg: &Config) -> Result<()> {
todo!()
}

0
src/serverapi/mod.rs Normal file
View File