cli: make output gooder #397
No reviewers
Labels
No labels
Compat/Breaking
Component/Enclave-Builder
Component/Infrastructure
Deploy/BYOC
Deploy/Full-managed
Deploy/Self-hosted
Interface/API
Interface/CLI
Interface/Git
Interface/Web
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
public/platform!397
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/397/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Review finding
Thanks for the cleanup here. I found one significant regression worth fixing before merge:
Baremetal credential defaults are no longer reachable, and EOF can loop forever
prompt::text()now guarantees a non-empty line by re-prompting on empty input:src/cli/src/prompt.rs:20-30That is fine for required fields, but this PR also uses it for prompts that advertise defaults and whose following code still expects an empty answer to be meaningful:
src/cli/src/lib.rs:7775—SSH Port [22]:followed byparse().unwrap_or(22)src/cli/src/lib.rs:7780—Use SSH key (k) or password (p)? [k]:src/cli/src/lib.rs:7786-7794—Path to SSH private key [~/.ssh/id_ed25519]:followed by anif key_path.is_empty()default branchWith the new helper, pressing Enter just re-prompts forever, so the displayed defaults are not actually selectable and the
key_path.is_empty()branch is dead. This is a user-visible regression forcaution credentials add ... baremetal.There is also an EOF/non-interactive edge case:
read_line()returnsOk(0)on EOF,inputstays empty, andprompt::text()loops forever printing the prompt instead of returning an error. Existing code inlib.rsalready has testable optional/non-empty prompt helpers (prompt_optional_line_from/prompt_line_from) that distinguish these cases, so I’d either reuse that pattern here or add anallow_empty/defaultprompt helper inprompt.rsand maketext()return an error on EOF.Checks I ran:
Both passed; this appears to be a behavior gap not covered by the current tests.
Follow-up review
Thanks, the fix commit addresses the previous baremetal default/EOF regression I flagged:
prompt::text()now returnsUnexpectedEofon EOF, and the baremetal prompts that advertise defaults now useprompt::text_or_default().One remaining merge blocker I found is formatting: the PR branch is not
rustfmtclean for the changed CLI files.This currently fails with diffs in:
src/cli/src/apps/download_eif.rssrc/cli/src/apps/migrate_procfile.rssrc/cli/src/lib.rsgit diff --check origin/main...HEADandcargo test -p cliboth pass for me. I think this just needscargo fmt -p cli(or equivalent repo formatter) before merge.