-
Notifications
You must be signed in to change notification settings - Fork 950
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
feature: enable managing more containers for some commands #1357
feature: enable managing more containers for some commands #1357
Conversation
95942db
to
06ff967
Compare
Codecov Report
@@ Coverage Diff @@
## master #1357 +/- ##
==========================================
- Coverage 17.34% 17.26% -0.08%
==========================================
Files 189 189
Lines 11832 11886 +54
==========================================
Hits 2052 2052
- Misses 9632 9686 +54
Partials 148 148
|
Could you help to review this? @ZouRui89 Thanks a lot. |
cli/pause.go
Outdated
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// pauseDescription is used to describe pause command in detail and auto generate command doc. | ||
var pauseDescription = "Pause a running container object in Pouchd. " + | ||
var pauseDescription = "Pause one or more running containers object in Pouchd. " + | ||
"when pausing, the container will pause its running but hold all the relevant resource." + | ||
"This is useful when you wish to pause a container for a while and to restore the running status later." + |
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.
Please change the corresponding amount here. Thx.
cli/pause.go
Outdated
@@ -22,10 +24,10 @@ type PauseCommand struct { | |||
func (p *PauseCommand) Init(c *Cli) { | |||
p.cli = c | |||
p.cmd = &cobra.Command{ | |||
Use: "pause CONTAINER", | |||
Short: "Pause a running container", | |||
Use: "pause CONTAINER [CONTAINERS]", |
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.
Change the value of Use
to "pause CONTAINER [CONTAINER...]".
cli/rm.go
Outdated
|
||
"github.com/alibaba/pouch/apis/types" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rmDescription = ` | ||
Remove a container object in Pouchd. | ||
Remove one or more container objects in Pouchd. |
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.
Just delete the word object
to keep consistency with other commands.
cli/start.go
Outdated
@@ -29,9 +31,9 @@ func (s *StartCommand) Init(c *Cli) { | |||
s.cli = c | |||
s.cmd = &cobra.Command{ | |||
Use: "start [OPTIONS] CONTAINER", |
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.
"start [OPTIONS] CONTAINER [CONTAINER...]"
cli/start.go
Outdated
if s.attach || s.stdin { | ||
var wait chan struct{} | ||
// We're going to attach to a container, we should make sure we only have one container. |
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.
Change it to "If We're going to attach to a container, we should make sure we only have one container."
if len(errs) > 0 { | ||
return errors.New(strings.Join(errs, "\n")) | ||
} | ||
|
||
return nil | ||
} | ||
|
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.
Change the value of Use
to update amount in init
function.
Please use "commit -sm" to sign off your commits. |
Thx a lot for your work. |
06ff967
to
398fa85
Compare
Thanks for your careful review~ |
test/cli_start_test.go
Outdated
res2 := command.PouchRun("create", "--name", name2, busyboxImage, "top") | ||
defer DelContainerForceMultyTime(c, name2) | ||
res2.Assert(c, icmd.Success) | ||
|
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.
A for
circulation can be used here to enhance the degree of simplicity. Just like the way you do in TestUnpauseMultiContainers
.
test/cli_restart_test.go
Outdated
res2 := command.PouchRun("run", "-d", "--cpu-share", "20", "--name", name2, busyboxImage) | ||
defer DelContainerForceMultyTime(c, name2) | ||
res2.Assert(c, icmd.Success) | ||
|
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.
The same circulation problem as below.
OK, I'll fix this, thanks. |
Signed-off-by: xiechengsheng <XIE1995@whut.edu.cn>
398fa85
to
dfb3444
Compare
LGTM |
enable managing more containers for some commands
Ⅰ. Describe what this PR did
Some commands just support managing one container/image, which is inconvenient for users to use. This pr enables managing one or more containers for some client commands and fixes little bugs in commands that support manage more than one container by now.
Ⅱ. Does this pull request fix one issue?
NONE.
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
More test codes are in test folder.
Ⅴ. Special notes for reviews