56ace481c1
see also
3ee9780df1
and
https://golang.org/cmd/go/#hdr-Remote_import_paths
and
https://golang.org/cmd/go/#hdr-Import_path_checking
Change-Id: I2ac906b1a1befde21edbcfc9b0a1b6a4863520da
37 lines
776 B
Go
37 lines
776 B
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package process // import "storj.io/storj/pkg/process"
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
cobra.MousetrapHelpText = "This is a command line tool.\n\n" +
|
|
"This needs to be run from a Command Prompt.\n"
|
|
|
|
// Figure out the executable name.
|
|
exe, err := os.Executable()
|
|
if err == nil {
|
|
cobra.MousetrapHelpText += fmt.Sprintf(
|
|
"Try running \"%s help\" for more information\n", exe)
|
|
}
|
|
}
|
|
|
|
// check if file exists, handle error correctly if it doesn't
|
|
func fileExists(path string) bool {
|
|
_, err := os.Stat(path)
|
|
if err != nil {
|
|
if os.IsNotExist(err) {
|
|
return false
|
|
}
|
|
log.Fatalf("failed to check for file existence: %v", err)
|
|
}
|
|
return true
|
|
}
|