-
Notifications
You must be signed in to change notification settings - Fork 133
Open
Description
Most commands use the Q for querying a list of results. There format is very non-user friendly.
Query string to query resources. Supported query patterns are "exact match(k=v)", "fuzzy match(k=~v)", "range(k=[min~max])", "list with union releationship(k={v1 v2 v3})" and "list with intersetion relationship(k=(v1 v2 v3))". The value of range and list can be string(enclosed by " or '), integer or time(in format "2020-04-09 02:36:00"). All of these query patterns should be put in the query string "q=xxx" and splitted by ",". e.g. q=k1=v1,k2=~v2,k3=[min~max]
This is the official description.
Ex: name=~some,id=222
And in a command this would look like:-
harbor-cli user list --query name=~some,id=222
This is un-intuitive.
Instead for a more UX friendly approach we have a new solution in some of the commands. Which is,
harbor-cli user list --fuzzy name=some --match id=222 ---range <something>
And this is supported by,
func BuildQueryParam(fuzzy, match, ranges []string, validKeys []string) (string, error) {
In the pkg/utils/query.go.
With flag format like this,
flags.StringSliceVar(&fuzzy, "fuzzy", nil, "Fuzzy match filter (key=value)")
flags.StringSliceVar(&match, "match", nil, "exact match filter (key=value)")
flags.StringSliceVar(&ranges, "range", nil, "range filter (key=min~max)")
Although this is implemented for a few of the new commands, the old ones still rely on the outdated format.
We need to update them to be similar to the new ones.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels