cmd

package
v0.0.0-...-34f2763 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "gows",
	Short: "Go Workspace / Environment Manager, to easily manage the Go Workspace during development.",
	Long: `Go Workspace / Environment Manager, to easily manage the Go Workspace during development.

Work in isolated (development) environment when you're working on your Go projects.
No cross-project dependency version missmatch, no more packages left out from vendor/.

No need for initializing a go workspace either, your project can be located anywhere,
not just in a predefined $GOPATH workspace. gows will take care about crearing
the (per-project isolated) workspace directory structure, no matter where your project is located.

gows works perfectly with other Go tools, all it does is it ensures that every project
gets it's own, isolated Go workspace and sets $GOPATH accordingly.

Sync Mode can be set in the .gows.user.yml config file,
or through the $GOWS_SYNC_MODE environment variable.`,

	DisableFlagParsing: true,

	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		initLogFormatter()

		if loglevelFlag == "" {
			if loglevelEnv := os.Getenv("GOWS_LOGLEVEL"); loglevelEnv != "" {
				loglevelFlag = loglevelEnv
			} else {

				loglevelFlag = "info"
			}
		}

		level, err := log.ParseLevel(loglevelFlag)
		if err != nil {
			return err
		}
		log.SetLevel(level)

		return nil
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func AutoScanPackageName

func AutoScanPackageName() (string, error)

AutoScanPackageName ...

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func InitGOWS

func InitGOWS(packageName string, isAllowReset bool) error

InitGOWS ...

func PrepareEnvironmentAndRunCommand

func PrepareEnvironmentAndRunCommand(userConfig config.UserConfigModel, cmdName string, cmdArgs ...string) (int, error)

PrepareEnvironmentAndRunCommand ... Returns the exit code of the command and any error occured in the function

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL