MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / runGuestsShow

Function runGuestsShow

internal/cli/guests.go:206–247  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

204}
205
206func 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

Callers

nothing calls this directly

Calls 8

parseVMIDFunction · 0.85
printErrorFunction · 0.85
initCLISessionFunction · 0.85
vmToGuestOutputFunction · 0.85
getOutputFormatFunction · 0.85
printTableFunction · 0.85
printJSONFunction · 0.85
findVMMethod · 0.80

Tested by

no test coverage detected