Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
alexng353 committed Feb 12, 2025
1 parent f1ac78c commit e198182
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
15 changes: 13 additions & 2 deletions src/commands/get/projects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,19 @@ pub async fn command(args: Args) -> Result<()> {
.context("Failed to get projects from server".red())?;
let remote_projects = remote_projects
.iter()
.filter(|p| !local_projects.iter().any(|lp| lp.project_id == p.project_id))
.map(|p| format!("{} - {} - {}", p.project_id, p.project_name, "Remote".green()));
.filter(|p| {
!local_projects
.iter()
.any(|lp| lp.project_id == p.project_id)
})
.map(|p| {
format!(
"{} - {} - {}",
p.project_id,
p.project_name,
"Remote".green()
)
});

let local_projects = local_projects
.iter()
Expand Down
7 changes: 5 additions & 2 deletions src/sdk.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::*;
use crate::{
types::ProjectInfo,
types::ListProjects,
types::ProjectInfo,
utils::{
auth::get_token,
config::get_config,
Expand Down Expand Up @@ -465,7 +465,10 @@ impl SDK {
Ok(project_data)
}

pub async fn new_project(partial_fingerprint: &str, project_name: &str) -> Result<String> {
pub async fn new_project(
partial_fingerprint: &str,
project_name: &str,
) -> Result<String> {
// POST /v2/projects/new
let client = reqwest::Client::new();

Expand Down
11 changes: 9 additions & 2 deletions src/utils/choice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ impl Choice {

let all_projects = all_projects
.iter()
.filter(|p| !local_projects.iter().any(|lp| lp.project_id == p.project_id))
.filter(|p| {
!local_projects
.iter()
.any(|lp| lp.project_id == p.project_id)
})
.collect::<Vec<_>>();

let mut options = local_projects
Expand All @@ -31,7 +35,10 @@ impl Choice {
.collect::<Vec<_>>();

all_projects.iter().for_each(|p| {
options.push(format!("{} - {} - {}", p.project_id, p.project_name, "Remote"));
options.push(format!(
"{} - {} - {}",
p.project_id, p.project_name, "Remote"
));
});

let selected =
Expand Down

0 comments on commit e198182

Please sign in to comment.