also looking at this
feat: own runtime firmware candidates
#49
24 files
+1245
-92
| @@ -0,0 +1,17 @@ | ||
| 1 | import { defineCommand } from '@stacksjs/cli' | |
| 2 | import { printAsync } from '../../resources/functions/cli/output' | |
| 3 | import { storeCommandFailure, storeCommandReference, storeReferenceFlags } from '../../resources/functions/drone/updates/command' | |
| 4 | import { retireRuntimeFirmwareCandidate } from '../../resources/functions/drone/updates/store' | |
| 5 | ||
| 6 | export default defineCommand({ | |
| 7 | name: 'updates:retire <directory>', | |
| 8 | description: 'Retire the exact active candidate reservation while retaining its history, bytes and trust floors', | |
| 9 | options: { ...storeReferenceFlags, '--candidate <id>': 'Exact active candidate identity from pinned store status' }, | |
| 10 | async handle(options, directory) { | |
| 11 | try { | |
| 12 | if (typeof options.candidate !== 'string') throw new Error('Explicit candidate identity required') | |
| 13 | await printAsync(JSON.stringify(await retireRuntimeFirmwareCandidate({ ...storeCommandReference(options, directory), candidateId: options.candidate }))) | |
| 14 | } | |
| 15 | catch { await storeCommandFailure() } | |
| 16 | }, | |
| 17 | }) | |