Skip to content

Commit

Permalink
fix: sort 'fluvio profile list' output (#4263)
Browse files Browse the repository at this point in the history
  • Loading branch information
digikata authored Nov 19, 2024
1 parent 07eb5d2 commit 483d5d1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions crates/fluvio-cli/src/profile/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ impl TableOutputHandler for ListConfig<'_> {
}

fn content(&self) -> Vec<Row> {
self.0
.profile
let mut profile_names = self.0.profile.keys().collect::<Vec<_>>();
profile_names.sort();
profile_names
.iter()
.map(|(profile_name, profile)| {
.filter_map(|profile_name| {
let profile = self.0.profile.get(profile_name.as_str())?;
let active = self
.0
.current_profile_name()
.map(|it| it == profile_name)
.map(|it| it == profile_name.as_str())
.map(|active| if active { "*" } else { "" })
.unwrap_or("");

Expand All @@ -78,8 +80,8 @@ impl TableOutputHandler for ListConfig<'_> {
)
})
.unwrap_or(("", "", "", String::new()));

Row::from([active, profile_name, cluster, addr, tls, &installation])
let row = Row::from([active, profile_name, cluster, addr, tls, &installation]);
Some(row)
})
.collect()
}
Expand Down

0 comments on commit 483d5d1

Please sign in to comment.