diff --git a/src/cmd/linuxkit/push.go b/src/cmd/linuxkit/push.go index e168ba3af..d224c9f39 100644 --- a/src/cmd/linuxkit/push.go +++ b/src/cmd/linuxkit/push.go @@ -3,19 +3,21 @@ package main import ( "fmt" "os" + "path/filepath" log "github.com/Sirupsen/logrus" ) func pushUsage() { - fmt.Printf("USAGE: %s push [backend] [options] [prefix]\n\n", os.Args[0]) + invoked := filepath.Base(os.Args[0]) + fmt.Printf("USAGE: %s push [backend] [options] [prefix]\n\n", invoked) fmt.Printf("'backend' specifies the push backend.\n") fmt.Printf("Supported backends are\n") fmt.Printf(" gcp\n") fmt.Printf("\n") fmt.Printf("'options' are the backend specific options.\n") - fmt.Printf("See 'moby push [backend] --help' for details.\n\n") + fmt.Printf("See '%s push [backend] --help' for details.\n\n", invoked) fmt.Printf("'prefix' specifies the path to the VM image.\n") } diff --git a/src/cmd/linuxkit/push_gcp.go b/src/cmd/linuxkit/push_gcp.go index 68818aa57..79860fe4d 100644 --- a/src/cmd/linuxkit/push_gcp.go +++ b/src/cmd/linuxkit/push_gcp.go @@ -4,6 +4,7 @@ import ( "flag" "fmt" "os" + "path/filepath" "strings" log "github.com/Sirupsen/logrus" @@ -12,8 +13,9 @@ import ( // Process the run arguments and execute run func pushGcp(args []string) { gcpCmd := flag.NewFlagSet("gcp", flag.ExitOnError) + invoked := filepath.Base(os.Args[0]) gcpCmd.Usage = func() { - fmt.Printf("USAGE: %s push gcp [options] [name]\n\n", os.Args[0]) + fmt.Printf("USAGE: %s push gcp [options] [name]\n\n", invoked) fmt.Printf("'name' specifies the full path of an image file which will be uploaded\n") fmt.Printf("Options:\n\n") gcpCmd.PrintDefaults() diff --git a/src/cmd/linuxkit/run.go b/src/cmd/linuxkit/run.go index 4fdf0431d..34827ec8a 100644 --- a/src/cmd/linuxkit/run.go +++ b/src/cmd/linuxkit/run.go @@ -3,13 +3,15 @@ package main import ( "fmt" "os" + "path/filepath" "runtime" log "github.com/Sirupsen/logrus" ) func runUsage() { - fmt.Printf("USAGE: %s run [backend] [options] [prefix]\n\n", os.Args[0]) + invoked := filepath.Base(os.Args[0]) + fmt.Printf("USAGE: %s run [backend] [options] [prefix]\n\n", invoked) fmt.Printf("'backend' specifies the run backend.\n") fmt.Printf("If not specified the platform specific default will be used\n") @@ -21,7 +23,7 @@ func runUsage() { fmt.Printf(" packet\n") fmt.Printf("\n") fmt.Printf("'options' are the backend specific options.\n") - fmt.Printf("See 'linuxkit run [backend] --help' for details.\n\n") + fmt.Printf("See '%s run [backend] --help' for details.\n\n", invoked) fmt.Printf("'prefix' specifies the path to the VM image.\n") fmt.Printf("It defaults to './image'.\n") } diff --git a/src/cmd/linuxkit/run_gcp.go b/src/cmd/linuxkit/run_gcp.go index b29e8714e..fc8506035 100644 --- a/src/cmd/linuxkit/run_gcp.go +++ b/src/cmd/linuxkit/run_gcp.go @@ -4,6 +4,7 @@ import ( "flag" "fmt" "os" + "path/filepath" log "github.com/Sirupsen/logrus" ) @@ -27,8 +28,9 @@ const ( // Process the run arguments and execute run func runGcp(args []string) { gcpCmd := flag.NewFlagSet("gcp", flag.ExitOnError) + invoked := filepath.Base(os.Args[0]) gcpCmd.Usage = func() { - fmt.Printf("USAGE: %s run gcp [options] [name]\n\n", os.Args[0]) + fmt.Printf("USAGE: %s run gcp [options] [name]\n\n", invoked) fmt.Printf("'name' specifies either the name of an already uploaded\n") fmt.Printf("GCP image or the full path to a image file which will be\n") fmt.Printf("uploaded before it is run.\n\n") diff --git a/src/cmd/linuxkit/run_hyperkit.go b/src/cmd/linuxkit/run_hyperkit.go index 3052c08aa..86f3ff7b1 100644 --- a/src/cmd/linuxkit/run_hyperkit.go +++ b/src/cmd/linuxkit/run_hyperkit.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "net" "os" + "path/filepath" log "github.com/Sirupsen/logrus" "github.com/moby/hyperkit/go" @@ -16,8 +17,9 @@ import ( // Process the run arguments and execute run func runHyperKit(args []string) { hyperkitCmd := flag.NewFlagSet("hyperkit", flag.ExitOnError) + invoked := filepath.Base(os.Args[0]) hyperkitCmd.Usage = func() { - fmt.Printf("USAGE: %s run hyperkit [options] prefix\n\n", os.Args[0]) + fmt.Printf("USAGE: %s run hyperkit [options] prefix\n\n", invoked) fmt.Printf("'prefix' specifies the path to the VM image.\n") fmt.Printf("\n") fmt.Printf("Options:\n") diff --git a/src/cmd/linuxkit/run_packet.go b/src/cmd/linuxkit/run_packet.go index 080b4821d..57ef71e7c 100644 --- a/src/cmd/linuxkit/run_packet.go +++ b/src/cmd/linuxkit/run_packet.go @@ -4,10 +4,12 @@ import ( "encoding/json" "flag" "fmt" - log "github.com/Sirupsen/logrus" - "github.com/packethost/packngo" "net/http" "os" + "path/filepath" + + log "github.com/Sirupsen/logrus" + "github.com/packethost/packngo" ) const ( @@ -39,8 +41,9 @@ func ValidateHTTPURL(url string) { // Process the run arguments and execute run func runPacket(args []string) { packetCmd := flag.NewFlagSet("packet", flag.ExitOnError) + invoked := filepath.Base(os.Args[0]) packetCmd.Usage = func() { - fmt.Printf("USAGE: %s run packet [options] [name]\n\n", os.Args[0]) + fmt.Printf("USAGE: %s run packet [options] [name]\n\n", invoked) fmt.Printf("Options:\n\n") packetCmd.PrintDefaults() } diff --git a/src/cmd/linuxkit/run_qemu.go b/src/cmd/linuxkit/run_qemu.go index c0d515890..6a0f7aa70 100644 --- a/src/cmd/linuxkit/run_qemu.go +++ b/src/cmd/linuxkit/run_qemu.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "os" "os/exec" + "path/filepath" log "github.com/Sirupsen/logrus" ) @@ -33,9 +34,10 @@ type QemuConfig struct { } func runQemu(args []string) { + invoked := filepath.Base(os.Args[0]) qemuFlags := flag.NewFlagSet("qemu", flag.ExitOnError) qemuFlags.Usage = func() { - fmt.Printf("USAGE: %s run qemu [options] prefix\n\n", os.Args[0]) + fmt.Printf("USAGE: %s run qemu [options] prefix\n\n", invoked) fmt.Printf("'prefix' specifies the path to the VM image.\n") fmt.Printf("\n") fmt.Printf("Options:\n") diff --git a/src/cmd/linuxkit/run_vmware.go b/src/cmd/linuxkit/run_vmware.go index f34fd62a2..57b4f2a0f 100644 --- a/src/cmd/linuxkit/run_vmware.go +++ b/src/cmd/linuxkit/run_vmware.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "os" "os/exec" + "path/filepath" "runtime" log "github.com/Sirupsen/logrus" @@ -58,9 +59,10 @@ guestOS = "other3xlinux-64" ` func runVMware(args []string) { + invoked := filepath.Base(os.Args[0]) vmwareArgs := flag.NewFlagSet("vmware", flag.ExitOnError) vmwareArgs.Usage = func() { - fmt.Printf("USAGE: %s run vmware [options] prefix\n\n", os.Args[0]) + fmt.Printf("USAGE: %s run vmware [options] prefix\n\n", invoked) fmt.Printf("'prefix' specifies the path to the VM image.\n") fmt.Printf("\n") fmt.Printf("Options:\n")