Compartmentalised a bit

main
Michal 2 years ago
parent e7d1939913
commit ffea06b54e

@ -16,6 +16,19 @@ mod internal;
mod operations; mod operations;
mod repository; mod repository;
fn repository(verbose: bool) -> bool {
// Parse config
let config = parse_cfg(verbose);
log!(verbose, "Config: {:?}", config);
// Get repository mode status
let repository = config.base.mode == "repository";
log!(verbose, "Repository Mode: {:?}", repository);
// Return repository mode status
repository
}
fn main() { fn main() {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
if unsafe { libc::geteuid() } == 0 { if unsafe { libc::geteuid() } == 0 {
@ -37,14 +50,7 @@ fn main() {
Operation::Build { Operation::Build {
packages, no_regen, .. packages, no_regen, ..
} => { } => {
// Parse config if !repository(verbose) {
let config = parse_cfg(verbose);
log!(verbose, "Config: {:?}", config);
// Get repository mode status
let repository = config.base.mode == "repository";
log!(verbose, "Repository Mode: {:?}", repository);
if !repository {
crash!( crash!(
AppExitCode::BuildInWorkspace, AppExitCode::BuildInWorkspace,
"Cannot build packages in workspace mode" "Cannot build packages in workspace mode"
@ -56,14 +62,7 @@ fn main() {
packages, no_regen, .. packages, no_regen, ..
} => operations::pull(packages, exclude, verbose, no_regen), } => operations::pull(packages, exclude, verbose, no_regen),
Operation::RepoGen => { Operation::RepoGen => {
// Parse config if !repository(verbose) {
let config = parse_cfg(verbose);
log!(verbose, "Config: {:?}", config);
// Get repository mode status
let repository = config.base.mode == "repository";
log!(verbose, "Repository Mode: {:?}", repository);
if !repository {
crash!( crash!(
AppExitCode::BuildInWorkspace, AppExitCode::BuildInWorkspace,
"Cannot generate repository in workspace mode" "Cannot generate repository in workspace mode"
@ -73,14 +72,7 @@ fn main() {
} }
Operation::Config => operations::config(verbose), Operation::Config => operations::config(verbose),
Operation::Prune => { Operation::Prune => {
// Parse config if !repository(verbose) {
let config = parse_cfg(verbose);
log!(verbose, "Config: {:?}", config);
// Get repository mode status
let repository = config.base.mode == "repository";
log!(verbose, "Repository Mode: {:?}", repository);
if !repository {
crash!( crash!(
AppExitCode::BuildInWorkspace, AppExitCode::BuildInWorkspace,
"Cannot prune packages in workspace mode" "Cannot prune packages in workspace mode"

Loading…
Cancel
Save