Skip to content

Commit

Permalink
Move console UI related modules to console parent module
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniusnaumann committed Oct 7, 2023
1 parent 124ed18 commit 91d7c32
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 21 deletions.
4 changes: 1 addition & 3 deletions src/commands/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ use std::process::Stdio;
use clap::ValueEnum;
use execute::{command, Execute};

use crate::config::Config;
use crate::error::Result;
use crate::console::{run_step, Config, Result};
use crate::lib_type::LibType;
use crate::step::run_step;

#[derive(ValueEnum, Debug, Clone)]
#[value()]
Expand Down
11 changes: 4 additions & 7 deletions src/commands/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ use execute::{command, Execute};
use indicatif::MultiProgress;

use crate::bindings::generate_bindings;
use crate::error::*;
use crate::console::*;
use crate::console::{run_step, run_step_with_commands};
use crate::lib_type::LibType;
use crate::spinners::*;
use crate::step::{run_step, run_step_with_commands};
use crate::swiftpackage::{create_swiftpackage, recreate_output_dir};
use crate::targets::*;
use crate::xcframework::create_xcframework;
use crate::*;

#[derive(ValueEnum, Debug, Clone)]
#[value()]
Expand Down Expand Up @@ -262,9 +260,8 @@ fn pick_lib_type(options: &[LibType], suggested: Option<LibType>) -> Result<LibT
return Ok(*result);
}

// TODO: Remove on next breaking version bump, this is only here to not induce a breaking change in the tools behavior
if options.iter().any(|i| matches!(&i, LibType::Dynamic)) {
return Ok(LibType::Dynamic);
if options.iter().any(|i| matches!(&i, LibType::Static)) {
return Ok(LibType::Static);
}

// TODO: Prompt user if multiple library types are present
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added src/console/messages.rs
Empty file.
2 changes: 1 addition & 1 deletion src/spinners.rs → src/console/spinners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{process::Command, time::Duration};

use indicatif::{MultiProgress, ProgressBar, ProgressStyle};

use crate::CommandInfo;
use super::CommandInfo;

const TICK_RATE: Duration = Duration::from_millis(30);

Expand Down
5 changes: 3 additions & 2 deletions src/step.rs → src/console/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use std::process::{Command, Stdio};

use indicatif::MultiProgress;

use crate::spinners::{CommandSpinner, MainSpinner, OptionalMultiProgress, Ticking};
use crate::{CommandInfo, Config, Result};
use super::{
CommandInfo, CommandSpinner, Config, MainSpinner, OptionalMultiProgress, Result, Ticking,
};

pub fn run_step<T, E, S>(config: &Config, title: S, execute: E) -> Result<T>
where
Expand Down
25 changes: 17 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
#![allow(clippy::useless_format)]

mod command;
mod commands {
pub mod init;
pub mod package;
}
pub(crate) mod console {
mod command;
pub mod config;
pub mod error;
pub mod messages;
pub mod spinners;
pub mod step;

pub use command::*;
pub use config::*;
pub use error::*;
pub use messages::*;
pub use spinners::*;
pub use step::*;
}

mod bindings;
mod config;
mod error;
mod lib_type;
mod spinners;
mod step;
mod swiftpackage;
mod targets;
mod xcframework;

pub use command::*;
pub use commands::*;
pub use config::*;
pub use error::*;
pub use console::error::Result;
pub use console::Config;
pub use lib_type::LibType;
pub use targets::*;

Expand Down

0 comments on commit 91d7c32

Please sign in to comment.