Remote configuration

This commit is contained in:
Samuel Elliott
2022-07-23 19:57:09 +01:00
parent fe725f931a
commit 39ffa02e58
6 changed files with 275 additions and 0 deletions

View File

@@ -3,3 +3,4 @@ export * as validateDiscordTitles from './validate-discord-titles.js';
export * as exportDiscordTitles from './export-discord-titles.js';
export * as discordActivity from './discord-activity.js';
export * as discordRpc from './discord-rpc.js';
export * as remoteConfig from './remote-config.js';

View File

@@ -0,0 +1,35 @@
import createDebug from 'debug';
import type { Arguments as ParentArguments } from '../util.js';
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
const debug = createDebug('cli:util:remote-config');
export const command = 'remote-config';
export const desc = 'Show nxapi remote configuration';
export function builder(yargs: Argv<ParentArguments>) {
return yargs.option('json', {
describe: 'Output raw JSON',
type: 'boolean',
}).option('json-pretty-print', {
describe: 'Output pretty-printed JSON',
type: 'boolean',
});
}
type Arguments = YargsArguments<ReturnType<typeof builder>>;
export async function handler(argv: ArgumentsCamelCase<Arguments>) {
const { default: config } = await import('../../common/remote-config.js');
if (argv.jsonPrettyPrint) {
console.log(JSON.stringify(config, null, 4));
return;
}
if (argv.json) {
console.log(JSON.stringify(config));
return;
}
console.log('Remote config', config);
}