()
| 9 | ) |
| 10 | |
| 11 | func newArchitectureCmd() *cobra.Command { |
| 12 | architectureCmd := &cobra.Command{ |
| 13 | Use: "architecture", |
| 14 | Aliases: []string{"arch"}, |
| 15 | Short: "Shows information about CPU and OS architecture", |
| 16 | Hidden: true, |
| 17 | Args: cobra.NoArgs, |
| 18 | RunE: func(cmd *cobra.Command, args []string) error { |
| 19 | s := system.NewSystem() |
| 20 | |
| 21 | osArchitecture, err := s.GetArchitecture() |
| 22 | if err != nil { |
| 23 | return fmt.Errorf("could not get OS architecture: %w", err) |
| 24 | } |
| 25 | |
| 26 | systemArchitecture, err := s.GetCpuArchitecture() |
| 27 | if err != nil { |
| 28 | return fmt.Errorf("could not get CPU architecture: %w", err) |
| 29 | } |
| 30 | |
| 31 | fmt.Fprintf(cmd.OutOrStdout(), "You are using a %s CPU on a %s OS\n", systemArchitecture, osArchitecture) |
| 32 | |
| 33 | return nil |
| 34 | }, |
| 35 | } |
| 36 | |
| 37 | architectureCmd.AddCommand(newOsArchitectureCmd()) |
| 38 | architectureCmd.AddCommand(newSystemArchitectureCmd()) |
| 39 | |
| 40 | return architectureCmd |
| 41 | } |
| 42 | |
| 43 | func newOsArchitectureCmd() *cobra.Command { |
| 44 | return &cobra.Command{ |
no test coverage detected