(cmd *cobra.Command, args []string)
| 204 | } |
| 205 | |
| 206 | func runGuestsShow(cmd *cobra.Command, args []string) error { |
| 207 | vmid, err := parseVMID(args[0]) |
| 208 | if err != nil { |
| 209 | return printError(err) |
| 210 | } |
| 211 | |
| 212 | session, initErr := initCLISession(cmd) |
| 213 | if initErr != nil { |
| 214 | return printError(initErr) |
| 215 | } |
| 216 | |
| 217 | if session == nil { |
| 218 | return nil |
| 219 | } |
| 220 | |
| 221 | vm, err := session.findVM(context.Background(), vmid) |
| 222 | if err != nil { |
| 223 | return printError(err) |
| 224 | } |
| 225 | |
| 226 | out := vmToGuestOutput(vm) |
| 227 | |
| 228 | if getOutputFormat(cmd) == outputTable { |
| 229 | printTable( |
| 230 | []string{"FIELD", "VALUE"}, |
| 231 | [][]string{ |
| 232 | {"ID", strconv.Itoa(out.ID)}, |
| 233 | {"Name", out.Name}, |
| 234 | {"Node", out.Node}, |
| 235 | {"Type", out.Type}, |
| 236 | {"Status", out.Status}, |
| 237 | {"IP", out.IP}, |
| 238 | {"Template", strconv.FormatBool(out.Template)}, |
| 239 | {"Tags", out.Tags}, |
| 240 | }, |
| 241 | ) |
| 242 | |
| 243 | return nil |
| 244 | } |
| 245 | |
| 246 | return printJSON(out) |
| 247 | } |
| 248 | |
| 249 | // ── guests lifecycle ───────────────────────────────────────────────────────── |
| 250 |
nothing calls this directly
no test coverage detected