From c8b36dfbfc11f11fbec07c8b2f68c4426342ca39 Mon Sep 17 00:00:00 2001 From: Simon Thulbourn Date: Fri, 9 Jan 2015 23:38:59 +0000 Subject: [PATCH] Add unknown command help Spits out "machine: '' is not a machine command see 'machine --help'" to be inline with Docker Signed-off-by: Simon Thulbourn --- commands.go | 10 ++++++++++ main.go | 1 + 2 files changed, 11 insertions(+) diff --git a/commands.go b/commands.go index aa1a708027..33a7efd78d 100644 --- a/commands.go +++ b/commands.go @@ -380,6 +380,16 @@ func cmdUrl(c *cli.Context) { fmt.Println(url) } +func cmdNotFound(c *cli.Context, command string) { + log.Fatalf( + "%s: '%s' is not a %s command. See '%s --help'.", + c.App.Name, + command, + c.App.Name, + c.App.Name, + ) +} + func getHost(c *cli.Context) *Host { name := c.Args().First() store := NewStore(c.GlobalString("storage-path")) diff --git a/main.go b/main.go index 87de555c91..62ed9bad6c 100644 --- a/main.go +++ b/main.go @@ -18,6 +18,7 @@ func main() { app := cli.NewApp() app.Name = "machine" app.Commands = Commands + app.CommandNotFound = cmdNotFound app.Usage = "Create and manage machines running Docker." app.Version = VERSION