UNPKG

balena-cli

Version:

The official balena Command Line Interface

44 lines (42 loc) 1.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@oclif/core"); const cf = require("../../utils/common-flags"); const lazy_1 = require("../../utils/lazy"); class ConfigReadCmd extends core_1.Command { async run() { const { flags: options } = await this.parse(ConfigReadCmd); const { safeUmount } = await Promise.resolve().then(() => require('../../utils/umount')); const drive = options.drive || (await (0, lazy_1.getVisuals)().drive('Select the device drive')); await safeUmount(drive); const config = await Promise.resolve().then(() => require('balena-config-json')); const configJSON = await config.read(drive, ''); if (options.json) { console.log(JSON.stringify(configJSON, null, 4)); } else { const prettyjson = await Promise.resolve().then(() => require('prettyjson')); console.log(prettyjson.render(configJSON)); } } } ConfigReadCmd.description = (0, lazy_1.stripIndent) ` Read the config.json file of a balenaOS image or attached media. Read the 'config.json' file of a balenaOS image file or attached SD card or USB stick. Documentation for the balenaOS 'config.json' file can be found at: https://www.balena.io/docs/reference/OS/configuration/ `; ConfigReadCmd.examples = [ '$ balena config read', '$ balena config read --drive /dev/disk2', '$ balena config read --drive balena.img', ]; ConfigReadCmd.flags = { drive: cf.driveOrImg, json: cf.json, }; ConfigReadCmd.root = true; ConfigReadCmd.offlineCompatible = true; exports.default = ConfigReadCmd; //# sourceMappingURL=read.js.map