cmd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InstallCmd = &cobra.Command{
	Use: "install",
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		currentUser, err := user.Current()
		if err != nil {
			fmt.Println("Something went wrong, please report this to the issues page on GitHub.")
		}
		if currentUser.Username != "root" {
			fmt.Println("error: you cannot perform this operation unless you are root.")
			os.Exit(1)
		}
	},
	Args: cobra.MinimumNArgs(1),
}
View Source
var UninstallCmd = &cobra.Command{
	Use: "uninstall",
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		currentUser, err := user.Current()
		if err != nil {
			fmt.Println("Something went wrong, please report this.")
		}
		if currentUser.Username != "root" {
			fmt.Println("Please run this command as root.")
			os.Exit(3)
		}
	},
	Args: cobra.MinimumNArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Printf("Please supply a program to uninstall \n")
	},
}
View Source
var UpdateCmd = &cobra.Command{
	Use: "update",
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		currentUser, err := user.Current()
		if err != nil {
			fmt.Println("Something went wrong, please report this to the issues page on GitHub.")
		}
		if currentUser.Username != "root" {
			fmt.Println("Please run this command as root.")
			os.Exit(1)
		}
	},
	Args: cobra.MinimumNArgs(1),
}

Functions

func Execute

func Execute()

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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