Skip to content

Commit

Permalink
Multi (#16)
Browse files Browse the repository at this point in the history
* added support for instaling multiple versions of IDF

* added support for multiple targets

---------

Co-authored-by: Petr Gadorek <[email protected]>
  • Loading branch information
Hahihula and Petr Gadorek authored Aug 6, 2024
1 parent 80ed1f5 commit 8b2d973
Show file tree
Hide file tree
Showing 4 changed files with 385 additions and 323 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions locales/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ prerequisites.missing:
en: The following prerequisites are not satisfied:%{l}
cn: 以下依赖项不满足:%{l}
prerequisites.install.prompt:
en: Do you want to install these prerequisites?
en: Do you want to install prerequisites?
cn: 是否要安装这些依赖项?
prerequisites.install.success:
en: Prerequisites installed successfully
Expand Down Expand Up @@ -120,8 +120,8 @@ wizard.spinner.message:
en: Doing something...
cn: 执行中
wizard.select_target.prompt:
en: Please select the target platform (esp chip)
cn: 请选择目标平台(ESP 芯片)
en: Please select all of the the target platforms (esp chips)
cn: 请选择所有的目标平台(esp 芯片)
wizard.select_target.prompt.failure:
en: We were unable to fetch avalible targets
cn: 无法获取可用的目标平台
Expand Down
26 changes: 18 additions & 8 deletions src/cli_args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ pub struct Settings {
pub idf_path: Option<PathBuf>,
pub tool_download_folder_name: Option<String>,
pub tool_install_folder_name: Option<String>,
pub target: Option<String>,
pub idf_version: Option<String>,
pub target: Option<Vec<String>>,
pub idf_versions: Option<Vec<String>>,
pub tools_json_file: Option<String>,
pub idf_tools_path: Option<String>, // relative to idf path
pub config_file: Option<PathBuf>,
pub non_interactive: Option<bool>,
pub wizard_all_questions: Option<bool>,
pub mirror: Option<String>,
pub idf_mirror: Option<String>,
}
Expand Down Expand Up @@ -67,7 +68,7 @@ pub struct Cli {
target: Option<String>,

#[arg(short, long)]
idf_version: Option<String>,
idf_versions: Option<String>,
#[arg(long)]
tool_download_folder_name: Option<String>,
#[arg(long)]
Expand All @@ -85,6 +86,11 @@ pub struct Cli {
#[arg(short, long)]
non_interactive: Option<bool>,

// #[arg(
// long,
// help = "The wizard will ask for every configurable option" //TODO: needs to be enabled inside wizard
// )]
// wizard_all_questions: Option<String>,
#[arg(
short,
long,
Expand Down Expand Up @@ -127,10 +133,15 @@ impl IntoIterator for Cli {
"non_interactive".to_string(),
self.non_interactive.map(|b| b.into()),
),
("target".to_string(), self.target.map(|p| p.into())),
(
"target".to_string(),
self.target
.map(|s| s.split(",").collect::<Vec<&str>>().into()),
),
(
"idf_version".to_string(),
self.idf_version.map(|s| s.into()),
self.idf_versions
.map(|s| s.split(",").collect::<Vec<&str>>().into()),
),
(
"tool_download_folder_name".to_string(),
Expand Down Expand Up @@ -180,9 +191,8 @@ impl Settings {
.build();

let log_level = match cli.verbose {
0 => log::LevelFilter::Warn,
1 => log::LevelFilter::Info,
2 => log::LevelFilter::Debug,
0 => log::LevelFilter::Info,
1 => log::LevelFilter::Debug,
_ => log::LevelFilter::Trace,
};

Expand Down
Loading

0 comments on commit 8b2d973

Please sign in to comment.