mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
Using the actual invoked command for help messages
Signed-off-by: Lorenzo Fontana <lo@linux.com>
This commit is contained in:
parent
1cd201aac5
commit
b28eab3912
@ -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")
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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")
|
||||
}
|
||||
|
@ -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")
|
||||
|
@ -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")
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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")
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user