Convert 'docker create' to use cobra and pflag

Return the correct status code on flag parsins errors.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 5ab24342258c70438ab8edf708ebc466b1677f38
Component: engine
This commit is contained in:
Daniel Nephin
2016-05-31 22:19:13 -07:00
committed by Vincent Demeester
parent d601c75fe5
commit 27d26eeb56
18 changed files with 301 additions and 253 deletions

View File

@ -73,6 +73,10 @@ func main() {
if sterr, ok := err.(cli.StatusError); ok {
if sterr.Status != "" {
fmt.Fprintln(stderr, sterr.Status)
}
// StatusError should only be used for errors, and all errors should
// have a non-zero exit status, so never exit with 0
if sterr.StatusCode == 0 {
os.Exit(1)
}
os.Exit(sterr.StatusCode)