feat(cli): exec and logs pick a lease when you do not name one - #395
Merged
Merged
Conversation
Finishes what #387 started for `vnc`. `kobe exec` and `kobe logs` take `[LEASE]`: with one lease that can serve the verb it is used, with several you pick from a list, with none you are told so. Only leases advertising the verb are offered. `port-forward` cannot join them, and the reason is structural rather than a decision: `spec` is a positional that follows the lease, and clap rejects an optional positional before a required one — Found non-required positional argument with a lower index than a required positional argument: "lease" index Some(1) Making it optional needs `spec` to become a flag or the two to swap places, and both break a command line people already use. That is recorded on the field so the next person does not rediscover it by hitting the assert. `exec` works because `--` already separates its trailing command: `kobe exec [OPTIONS] [LEASE] -- <COMMAND>...`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Finishes what #387 started for
vnc.kobe execandkobe logstake[LEASE]: with one lease that can serve the verb it is used, with several youpick from a list, with none you are told so. Only leases advertising the verb
are offered.
Non-interactive callers are unaffected — #387 put the terminal check inside
run_picker, so a script or an agent gets the candidates and how to name onerather than a hang.
port-forwardcannot join themNot a decision — clap rejects it:
specis a positional that follows the lease. Making the lease optional needsspecto become a flag or the two to swap places, and both break a commandline people already use. Recorded on the field so the next person does not
rediscover it by hitting the assert at runtime.
execworks because--already separates its trailing command:kobe exec [OPTIONS] [LEASE] -- <COMMAND>....Left out deliberately
cancelstill requires its lease. A picker there means one mis-aimed keypresscancels a lease, so it wants a decision on confirmation first.
Verification
213 unit + 48 integration tests,
clippy -p kobectl --all-targets --all-features -D warningsclean.--helpchecked for all three: