feat(cli): add aliases to commands

This commit is contained in:
Patryk Hegenberg 2025-01-23 07:59:26 +01:00
parent 53a50f2be4
commit 70dbc9e062
6 changed files with 20 additions and 27 deletions

View file

@ -10,9 +10,10 @@ import (
)
var RootCmd = &cobra.Command{
Use: "system_setup_tool",
Short: "Installs packages based on TOML configuration",
Run: tui.Run,
Use: "system_setup_tool",
Short: "Installs packages based on TOML configuration",
Version: "0.4.0",
Run: tui.Run,
}
func init() {

View file

@ -12,9 +12,10 @@ import (
)
var installCmd = &cobra.Command{
Use: "install [package_name]",
Short: "Install a package with the specified package manager",
Args: cobra.ExactArgs(1),
Use: "install [package_name]",
Short: "Install a package with the specified package manager",
Args: cobra.ExactArgs(1),
Aliases: []string{"i"},
Run: func(cmd *cobra.Command, args []string) {
packageName := args[0]
managerName, _ := cmd.Flags().GetString("manager")

View file

@ -13,9 +13,10 @@ import (
)
var searchCmd = &cobra.Command{
Use: "search [package_name]",
Short: "Search for a package across package managers (will search in os|flatpak|homebrew)",
Args: cobra.ExactArgs(1),
Use: "search [package_name]",
Short: "Search for a package across package managers (will search in os|flatpak|homebrew)",
Args: cobra.ExactArgs(1),
Aliases: []string{"s"},
Run: func(cmd *cobra.Command, args []string) {
packageName := args[0]
managerName, _ := cmd.Flags().GetString("manager")

View file

@ -12,10 +12,11 @@ import (
)
var updateCmd = &cobra.Command{
Use: "update [package_name]",
Short: "update a package with the specified package manager.",
Long: "update a package with the specified package manager.\nIf no package specified, all packages for the package manager will be updated",
Args: cobra.ExactArgs(1),
Use: "update [package_name]",
Short: "update a package with the specified package manager.",
Long: "update a package with the specified package manager.\nIf no package specified, all packages for the package manager will be updated",
Args: cobra.ExactArgs(1),
Aliases: []string{"u"},
Run: func(cmd *cobra.Command, args []string) {
packageName := args[0]
managerName, _ := cmd.Flags().GetString("manager")