@@ -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.
169169pub 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 {
0 commit comments