Compartmentalised a bit

main
Michal 2 years ago
parent 67b3e57fcd
commit 0b0e35a5af
No known key found for this signature in database
GPG Key ID: A6A1A4DCB22279B9

@ -16,6 +16,19 @@ mod internal;
mod operations;
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() {
#[cfg(target_os = "linux")]
if unsafe { libc::geteuid() } == 0 {
@ -37,14 +50,7 @@ fn main() {
Operation::Build {
packages, no_regen, ..
} => {
// 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);
if !repository {
if !repository(verbose) {
crash!(
AppExitCode::BuildInWorkspace,
"Cannot build packages in workspace mode"
@ -56,14 +62,7 @@ fn main() {
packages, no_regen, ..
} => operations::pull(packages, exclude, verbose, no_regen),
Operation::RepoGen => {
// 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);
if !repository {
if !repository(verbose) {
crash!(
AppExitCode::BuildInWorkspace,
"Cannot generate repository in workspace mode"
@ -73,14 +72,7 @@ fn main() {
}
Operation::Config => operations::config(verbose),
Operation::Prune => {
// 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);
if !repository {
if !repository(verbose) {
crash!(
AppExitCode::BuildInWorkspace,
"Cannot prune packages in workspace mode"

Loading…
Cancel
Save