subcommands

package
v0.0.0-...-1e073f2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Code = &cobra.Command{
		Use:   "code [src] dest",
		Short: "Subcommand to open specified path in vscode",
		Long:  ``,
		Args:  cobra.RangeArgs(1, 2),
		Run: func(cmd *cobra.Command, args []string) {
			cdx.SetDest(args[0])
			if len(args) == 2 {
				cdx.SetSrc(args[0])
				cdx.SetDest(args[1])
			}

			path := funcs.GetPath(cdx)

			if path == "" {
				log.Fatalf("%s is not located in %s", cdx.GetDest(), cdx.GetSrc())
			}

			command := exec.Command("code", path)
			err := command.Run()
			if err != nil {
				log.Fatalf("Error running code command on %s ===> %s", path, err.Error())
			}
		},
	}
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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