File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -416,6 +416,18 @@ snapshot
416416 deleteSnapshot ( id , options ) ;
417417 } ) ;
418418
419+ snapshot
420+ . command ( "get <id>" )
421+ . description ( "Get snapshot details" )
422+ . option (
423+ "-o, --output [format]" ,
424+ "Output format: text|json|yaml (default: json)" ,
425+ )
426+ . action ( async ( id , options ) => {
427+ const { getSnapshot } = await import ( "./commands/snapshot/get.js" ) ;
428+ await getSnapshot ( { id, ...options } ) ;
429+ } ) ;
430+
419431snapshot
420432 . command ( "status <snapshot-id>" )
421433 . description ( "Get snapshot operation status" )
Original file line number Diff line number Diff line change 1+ /**
2+ * Get snapshot details command
3+ */
4+
5+ import { getClient } from "../../utils/client.js" ;
6+ import { output , outputError } from "../../utils/output.js" ;
7+
8+ interface GetSnapshotOptions {
9+ id : string ;
10+ output ?: string ;
11+ }
12+
13+ export async function getSnapshot ( options : GetSnapshotOptions ) {
14+ try {
15+ const client = getClient ( ) ;
16+
17+ // This is the way to get snapshot details
18+ const snapshotDetails = await client . devboxes . diskSnapshots . queryStatus (
19+ options . id ,
20+ ) ;
21+ output ( snapshotDetails , { format : options . output , defaultFormat : "json" } ) ;
22+ } catch ( error ) {
23+ outputError ( "Failed to get snapshot" , error ) ;
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments