Skip to content

Commit

Permalink
feat: revamp status command
Browse files Browse the repository at this point in the history
This PR improves the feedback of the status command to live update the services responses. One "breaking change" is the removal of the --all/-a option.
With the idea to give better visibility of the overall status, that option doesn't make that much sense. (we can of course add it back if we think is very important here).

Changelog:
- Removed --all/-a options. Now all services are shown by default.
- Added dependency to [`crossterm`](https://docs.rs/crossterm/latest/crossterm/) to manipulate the terminal output.
- Cleaned up the output (removed "Service information:" and "Session information:" headers).
- Services statuses are update as soon as we get them.
- Removed `component_kind: linkup`. Internal Linkup services are reported as remote or local accordingly.
- Added priority option for component status. This way we can keep the Linkup internal services reported on the beginning of the list.
  • Loading branch information
augustoccesar committed Oct 28, 2024
1 parent 25d2507 commit 52b954a
Show file tree
Hide file tree
Showing 5 changed files with 236 additions and 131 deletions.
48 changes: 48 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions linkup-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ thiserror = "1.0.64"
url = { version = "2.5.2", features = ["serde"] }
base64 = "0.22.1"
env_logger = "0.11.5"
crossterm = "0.28.1"

[dev-dependencies]
mockall = "0.13.0"
4 changes: 1 addition & 3 deletions linkup-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ enum Commands {
// Output status in JSON format
#[arg(long)]
json: bool,
#[arg(short, long)]
all: bool,
},

#[clap(about = "Speed up your local environment by routing traffic locally when possible")]
Expand Down Expand Up @@ -252,7 +250,7 @@ fn main() -> Result<()> {
Commands::Reset => reset(),
Commands::Local { service_names, all } => local(service_names, *all),
Commands::Remote { service_names, all } => remote(service_names, *all),
Commands::Status { json, all } => status(*json, *all),
Commands::Status { json } => status(*json),
Commands::LocalDNS { subcommand } => match subcommand {
LocalDNSSubcommand::Install => local_dns::install(&cli.config),
LocalDNSSubcommand::Uninstall => local_dns::uninstall(&cli.config),
Expand Down
2 changes: 1 addition & 1 deletion linkup-cli/src/preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn preview(
.preview(&create_preview_request)
.map_err(|e| CliError::LoadConfig(url.to_string(), e.to_string()))?;

print_session_status(SessionStatus {
print_session_status(&SessionStatus {
name: preview_name.clone(),
domains: format_state_domains(&preview_name, &input_config.domains),
});
Expand Down
Loading

0 comments on commit 52b954a

Please sign in to comment.