oxidecomputer / oxide.rs

The Oxide Rust SDK and CLI
Mozilla Public License 2.0
37 stars 12 forks source link

Add progress spinner to auth status subcommand #748

Closed wfchandler closed 1 month ago

wfchandler commented 1 month ago

When an authenticated Oxide rack is unreachable, e.g. dogfood when the VPN is disabled, oxide auth status may take tens of seconds to complete. It is unclear to the user which rack is the source of the delay.

Add a progress spinner that shows the rack currently being checked.

Closes https://github.com/oxidecomputer/oxide.rs/issues/567

wfchandler commented 1 month ago

Video of spinner in action:

https://github.com/user-attachments/assets/ac26b652-c505-4d12-bbfb-452fba8f8cc8

wfchandler commented 1 month ago

How does this work with redirected output e.g. oxide auth status >out.txt

indicatif detects non-terminal output targets and hides itself, so if we pipe to a file it won't contain the spinner.

wfchandler commented 1 month ago

What do you think about not clearing the "Checking" line when it prints the error?

I think that looks a bit cleaner, updated.

$ oxide auth status
  Checking https://oxide.sys.r3.oxide-preview.com...
Profile "oxide" (https://oxide.sys.r3.oxide-preview.com) status: Authenticated
  Checking https://oxide.sys.rack2.eng.oxide.computer...
Profile "oxide2" (https://oxide.sys.rack2.eng.oxide.computer) status: Communication Error: error sending request for url (https://oxide.sys.rack2.eng.oxide.computer/v1/me): operation timed out