utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package utils provides extra utility for the program

Index

Constants

View Source
const ProgramName = "vikalanbo"

Variables

This section is empty.

Functions

func CheckGitConfig

func CheckGitConfig(key string) (bool, error)

func ExecuteCmd

func ExecuteCmd(name string, args []string, dir string) error

ExecuteCmd provides a shorthand way to run a shell command

func GetRootDir

func GetRootDir(moduleName string) string

GetRootDir returns the project directory name from the module path. Returns the last token by splitting the moduleName with /

func GoFmt

func GoFmt(appDir string) error

GoFmt runs "gofmt" in a selected directory using the simplify and overwrite flags

func GoGetPackage

func GoGetPackage(appDir string, packages []string) error

GoGetPackage runs "go get" for a given package in the selected directory

func GoModReplace

func GoModReplace(appDir string, replace string) error

GoModReplace runs "go mod edit -replace" in the selected replace_payload e.g: github.com/gocql/gocql=github.com/scylladb/[email protected]

func GoTidy

func GoTidy(appDir string) error

func InitGoMod

func InitGoMod(projectName string, appDir string) error

InitGoMod initializes go.mod with the given project name in the selected directory

func NonInteractiveCommand

func NonInteractiveCommand(use string, flagSet *pflag.FlagSet) string

NonInteractiveCommand creates the command string from a flagSet to be used for getting the equivalent non-interactive shell command

func RegisterStaticCompletions

func RegisterStaticCompletions(cmd *cobra.Command, flag string, options []string)

func ValidateModuleName

func ValidateModuleName(moduleName string) bool

ValidateModuleName returns true if it's a valid module name. It allows any number of / and . characters in between.

Types

This section is empty.

Jump to

Keyboard shortcuts

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