From 40354ec42264a44b8074cee8d45f107a2c52e831 Mon Sep 17 00:00:00 2001 From: Dmitry Muhomor Date: Mon, 28 Aug 2023 07:46:12 +0300 Subject: [PATCH] collect-state: set default output path to vendor/state --- src/commands/collect-state.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/commands/collect-state.ts b/src/commands/collect-state.ts index d0e3b6b..f6ea7b2 100644 --- a/src/commands/collect-state.ts +++ b/src/commands/collect-state.ts @@ -1,5 +1,6 @@ import { Command, flags } from '@oclif/command' import { promises as fs } from 'fs' +import { COLLECTED_SYSTEM_STATE_DIR } from '../config/paths' import { collectSystemState, serializeSystemState } from '../config/system-state' import { forEachDevice } from '../frontend/devices' @@ -21,14 +22,17 @@ export default class CollectState extends Command { description: 'generate devices in parallel (causes buggy progress spinners)', default: false, }), + outPath: flags.string({ + char: 'o', + description: `output path for system state JSON file(s). If it's a directory, $device.json will be used for file names`, + required: true, + default: COLLECTED_SYSTEM_STATE_DIR, + }), } - static args = [{ name: 'output_path', description: 'output path for system state JSON file(s)', required: true }] - async run() { let { - flags: { aapt2: aapt2Path, device: devices, outRoot, parallel }, - args: { output_path: outPath }, + flags: { aapt2: aapt2Path, device: devices, outRoot, parallel, outPath }, } = this.parse(CollectState) let isDir = (await fs.stat(outPath)).isDirectory()