cmd

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ComputerSetupCmd = &cobra.Command{
	Use: "computer-setup",
	Aliases: []string{
		"computersetup",
		"cs",
		"setup",
	},
	Short: "Configure host to developer preferences (cross platform)",
	Long: `Configure host to developer preferences.

Available subcommands:
  status - Check current setup status
  install - Apply configuration to setup this machine`,
}
View Source
var ListPackagesCmd = &cobra.Command{
	Use:   "list-packages",
	Short: "Show package count summary from all detected package managers",
	Long: `Show package count summary from all detected package managers.
	
For system package managers (apt, yum, brew, chocolatey, etc.), only explicitly 
installed packages are counted, not their dependencies.

For programming runtime package managers (npm, pip, gem, etc.), only globally 
installed packages are counted.

If a package manager is not detected on the system, it will not be displayed.

Use --detail flag to see the full list of all installed packages.`,
	Run: func(cmd *cobra.Command, args []string) {
		listInstalledPackages()
	},
}

ListPackagesCmd represents the list-packages command

View Source
var ResetCmd = &cobra.Command{
	Use:   "reset",
	Short: "Resets machine",
	Run: func(cmd *cobra.Command, args []string) {
		out := bytes.NewBufferString("")
		out.WriteString("System Info\n")
		out.WriteString("-----\n")
		err := status.SystemInfo(out)
		if err != nil {
			log.Fatalf("Issues getting operating system identifier")
		}
		out.WriteString("\n")

		os := osagnostic.NewOperatingSystem()
		identifier := computerSetup.MachineIdentifier{}
		configProvider := identifier.ConfigurationProviderForOperatingSystem(os.Name)
		if configProvider == nil {
			log.Fatal(fmt.Sprintf("No configuration provider found for operationg system %s", os.Name))
		}

		tweaker := computerSetup.NewMachineTweaker(configProvider.GetConfiguration())
		_, statusOut := tweaker.ResetConfiguration()
		out.WriteString(statusOut.String())

		log.Print(out)
	},
}

ResetCmd represents status command

View Source
var RuntimesCmd = &cobra.Command{
	Use:   "runtimes",
	Short: "Detects programmer development environment runtimes and displays their versions.",
	Run: func(cmd *cobra.Command, args []string) {
		found := false
		for name, cmdArgs := range runtimeCommands {
			c := exec.Command(cmdArgs[0], cmdArgs[1:]...)
			output, err := c.CombinedOutput()
			if err == nil {
				fmt.Printf("%s: %s\n", name, parseVersion(string(output)))
				found = true
			}
		}
		if !found {
			fmt.Println("No known runtimes detected.")
		}
	},
}
View Source
var StatusCmd = &cobra.Command{
	Use:   "status",
	Short: "Display system information (like neofetch)",
	Run: func(cmd *cobra.Command, args []string) {
		printSystemInfo()
	},
}

StatusCmd represents status command

Functions

func Execute

func Execute()

Execute comment for execute

Types

This section is empty.

Jump to

Keyboard shortcuts

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