collect-state: set default output path to vendor/state

This commit is contained in:
Dmitry Muhomor 2023-08-28 07:46:12 +03:00 committed by Daniel Micay
parent 2a3fba5d2e
commit 40354ec422

View file

@ -1,5 +1,6 @@
import { Command, flags } from '@oclif/command' import { Command, flags } from '@oclif/command'
import { promises as fs } from 'fs' import { promises as fs } from 'fs'
import { COLLECTED_SYSTEM_STATE_DIR } from '../config/paths'
import { collectSystemState, serializeSystemState } from '../config/system-state' import { collectSystemState, serializeSystemState } from '../config/system-state'
import { forEachDevice } from '../frontend/devices' import { forEachDevice } from '../frontend/devices'
@ -21,14 +22,17 @@ export default class CollectState extends Command {
description: 'generate devices in parallel (causes buggy progress spinners)', description: 'generate devices in parallel (causes buggy progress spinners)',
default: false, 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() { async run() {
let { let {
flags: { aapt2: aapt2Path, device: devices, outRoot, parallel }, flags: { aapt2: aapt2Path, device: devices, outRoot, parallel, outPath },
args: { output_path: outPath },
} = this.parse(CollectState) } = this.parse(CollectState)
let isDir = (await fs.stat(outPath)).isDirectory() let isDir = (await fs.stat(outPath)).isDirectory()