-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix container/sandbox list. #217
Fix container/sandbox list. #217
Conversation
cli.IntFlag{ | ||
Name: "last, n", | ||
Usage: "Show last n recently created sandboxes", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems two options are same. Merge last to latest and defaulting latest to one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially just want to keep the same UX with docker, but of course we could make change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@feiskyer I tried to merge them into one flag. But I find that it's hard to set default for -l
, because once you define it as an int flag, you have to specify a value when using it.
Given that I think it's fine to keep 2 flags as what docker does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, didn't notice this problem. let's keep both
ef9890a
to
0360805
Compare
cmd/crictl/container.go
Outdated
@@ -590,8 +590,8 @@ func ListContainers(client pb.RuntimeServiceClient, opts listOptions) error { | |||
if err != nil { | |||
return err | |||
} | |||
sort.Sort(containerByCreated(r.GetContainers())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think getContainersList should include sort.Sort inside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is more completer in logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I am OK. |
@@ -172,12 +166,12 @@ var listPodSandboxCommand = cli.Command{ | |||
Usage: "filter by pod sandbox namespace", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add shortname for namespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last
is using the shortname n
.
cmd/crictl/sandbox.go
Outdated
@@ -396,7 +400,8 @@ func ListPodSandboxes(client pb.RuntimeServiceClient, opts listOptions) error { | |||
if err != nil { | |||
return err | |||
} | |||
sort.Sort(sandboxBySort(r.Items)) | |||
sort.Sort(sandboxByCreated(r.GetItems())) | |||
r.Items = getSandboxesList(r.GetItems(), opts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Signed-off-by: Lantao Liu <[email protected]>
0360805
to
cd98da1
Compare
/lgtm |
For #179.
This PR:
-l
and-n
incrictl sandboxes
.--namespace
to filter.Signed-off-by: Lantao Liu [email protected]