Skip to content

Commit f661dd6

Browse files
committed
building offline installer only for stable versions now not prereleased
1 parent 6b8eddc commit f661dd6

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src-tauri/src/lib/idf_versions.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,38 @@ pub async fn get_idf_name_by_target(target: &String) -> Vec<String> {
167167
///
168168
/// * If there is an error fetching the IDF versions or processing them, an error message is logged.
169169
pub async fn get_idf_names() -> Vec<String> {
170+
get_idf_names_by_flag(true).await
171+
}
172+
173+
/// Retrieves the names of stable IDF versions.
174+
///
175+
/// This function fetches the IDF versions from the official website, filters out unstable versions,
176+
/// and returns a vector of stable IDF version names.
177+
/// # Returns
178+
/// * A vector of strings containing the names of stable IDF versions.
179+
/// If there is an error fetching the IDF versions or processing them, an empty vector is returned.
180+
/// # Errors
181+
/// * If there is an error fetching the IDF versions or processing them, an error message is logged.
182+
pub async fn get_stable_idf_names() -> Vec<String> {
183+
get_idf_names_by_flag(false).await
184+
}
185+
186+
/// Helper function to retrieve IDF version names based on stability flag.
187+
/// # Arguments
188+
/// * `include_unstable` - A boolean flag indicating whether to include unstable versions.
189+
/// # Returns
190+
/// * A vector of strings containing the names of IDF versions based on the stability flag.
191+
/// If there is an error fetching the IDF versions or processing them, an empty vector is returned.
192+
/// # Errors
193+
/// * If there is an error fetching the IDF versions or processing them, an error message is logged.
194+
async fn get_idf_names_by_flag(include_unstable: bool) -> Vec<String> {
170195
let versions = get_idf_versions().await;
171196
match versions {
172197
Ok(releases) => {
173198
let mut names = vec![];
174199
for version in &releases.VERSIONS {
175200
if version.end_of_life
201+
|| (!include_unstable && version.pre_release)
176202
|| version.old
177203
|| version.name == "latest"
178204
{

src-tauri/src/offline_installer_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ struct Args {
379379
async fn main() {
380380
let args = Args::parse();
381381
if args.list_versions {
382-
let versions = idf_im_lib::idf_versions::get_idf_names().await;
382+
let versions = idf_im_lib::idf_versions::get_stable_idf_names().await;
383383
for version in versions {
384384
println!("{}", version);
385385
}

0 commit comments

Comments
 (0)