Skip to content

Commit d8bd6e9

Browse files
author
farfromrefuge
committed
feat: add --json option to ns config
1 parent da9b7f9 commit d8bd6e9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/commands/config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,26 @@ import { IProjectConfigService } from "../definitions/project";
44
import { SupportedConfigValues } from "../tools/config-manipulation/config-transformer";
55
import { IErrors } from "../common/declarations";
66
import { color } from "../color";
7+
import { IOptions } from "../declarations";
78

89
export class ConfigListCommand implements ICommand {
910
public allowedParameters: ICommandParameter[] = [];
1011

1112
constructor(
1213
private $projectConfigService: IProjectConfigService,
14+
private $options: IOptions,
1315
private $logger: ILogger
1416
) {}
1517

1618
public async execute(args: string[]): Promise<void> {
1719
try {
1820
const config = this.$projectConfigService.readConfig();
19-
this.$logger.info(this.getValueString(config as SupportedConfigValues));
21+
if (this.$options.json) {
22+
console.log(JSON.stringify(config))
23+
} else {
24+
this.$logger.info(this.getValueString(config as SupportedConfigValues));
25+
26+
}
2027
} catch (error) {
2128
this.$logger.info("Failed to read config. Error is: ", error);
2229
}

0 commit comments

Comments
 (0)