Skip to content

Commit

Permalink
nit: styling
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaro00 committed May 20, 2024
1 parent e363e65 commit 52af30f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
5 changes: 4 additions & 1 deletion cargo-shuttle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,10 @@ impl Shuttle {
.map_err(suggestions::deployment::get_deployments_list_failure)?;
let table = deployments_table_beta(&deployments);

println!("Deployments in project '{}'", proj_name);
println!(
"{}",
format!("Deployments in project '{}'", proj_name).bold()
);
println!("{table}");
deployments.len()
} else {
Expand Down
25 changes: 13 additions & 12 deletions common/src/models/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,8 @@ pub fn deployments_table_beta(deployments: &[EcsResponse]) -> String {
Cell::new("Deployment ID"),
Cell::new("Status"),
Cell::new("Last updated"),
Cell::new("Commit ID"),
Cell::new("Commit Message"),
Cell::new("Branch"),
Cell::new("Dirty"),
Cell::new("Commit"),
]);

for deploy in deployments.iter() {
Expand All @@ -172,7 +170,7 @@ pub fn deployments_table_beta(deployments: &[EcsResponse]) -> String {
.git_commit_msg
.as_ref()
.map_or(String::from(GIT_OPTION_NONE_TEXT), |val| {
val.chars().take(24).collect::<String>()
val.chars().take(24).collect()
});

table.add_row(vec![
Expand All @@ -181,19 +179,22 @@ pub fn deployments_table_beta(deployments: &[EcsResponse]) -> String {
// Unwrap is safe because Color::from_str returns the color white if str is not a Color.
.fg(Color::from_str(deploy.latest_deployment_state.get_color()).unwrap()),
Cell::new(deploy.updated_at.format("%Y-%m-%dT%H:%M:%SZ")),
Cell::new(truncated_commit_id),
Cell::new(truncated_commit_msg),
Cell::new(
deploy
.git_branch
.as_ref()
.map_or(GIT_OPTION_NONE_TEXT, |val| val as &str),
),
Cell::new(
deploy
.git_dirty
.map_or(String::from(GIT_OPTION_NONE_TEXT), |val| val.to_string()),
.unwrap_or(&GIT_OPTION_NONE_TEXT.to_owned()),
),
Cell::new(format!(
"{}{} {}",
truncated_commit_id,
if deploy.git_dirty.is_some_and(|d| d) {
"*"
} else {
""
},
truncated_commit_msg,
)),
]);
}

Expand Down
2 changes: 1 addition & 1 deletion common/src/models/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ pub fn get_projects_table_beta(projects: &[ResponseBeta]) -> String {
.map(|s| s.get_color())
.unwrap_or_default();
table.add_row(vec![
Cell::new(&project.id),
Cell::new(&project.id).add_attribute(Attribute::Bold),
Cell::new(&project.name),
Cell::new(state)
// Unwrap is safe because Color::from_str returns the color white if the argument is not a Color.
Expand Down

0 comments on commit 52af30f

Please sign in to comment.