You've already forked panic-cli
mirror of
https://github.com/Print-and-Panic/panic-cli.git
synced 2026-01-21 10:17:41 -08:00
36 lines
585 B
Go
36 lines
585 B
Go
package software
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var launchCmd = &cobra.Command{
|
|
Use: "launch",
|
|
Short: "Launch a software package",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
if len(args) == 0 {
|
|
fmt.Println("No software specified.")
|
|
os.Exit(1)
|
|
}
|
|
|
|
sw, exists := softwareMap[args[0]]
|
|
if !exists {
|
|
fmt.Printf("Software '%s' not found.\n", args[0])
|
|
os.Exit(1)
|
|
}
|
|
|
|
if err := sw.Launch(); err != nil {
|
|
fmt.Printf("Failed to launch '%s': %v\n", args[0], err)
|
|
os.Exit(1)
|
|
}
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
SoftwareCmd.AddCommand(launchCmd)
|
|
|
|
}
|