refactor: add --merged and --no-merged flag

Signed-off-by: djamaile <rdjamaile@gmail.com>
This commit is contained in:
djamaile
2023-07-24 21:33:04 +02:00
parent cebbf8a27f
commit 8ebe96fece
4 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@backstage/cli': patch
---
Enable to print the config schema non merged with the `non-merged` flag
Enable to print the config schema non merged with the `--no-merged` flag
+2
View File
@@ -97,6 +97,8 @@ Usage: backstage-cli config:schema [options]
Options:
--package <name>
--format <format>
--merged
--no-merged
-h, --help
```
+1 -1
View File
@@ -29,7 +29,7 @@ export default async (opts: OptionValues) => {
});
let configSchema: JsonObject | JSONSchema;
if (!opts.nonMerged) {
if (opts.merged) {
configSchema = mergeConfigSchemas(
(schema.serialize().schemas as JsonObject[]).map(
_ => _.value as JSONSchema,
+2 -1
View File
@@ -365,7 +365,8 @@ export function registerCommands(program: Command) {
'--format <format>',
'Format to print the schema in, either json or yaml [yaml]',
)
.option('--non-merged', 'Enable to print the config schema non merged')
.option('--merged', 'Print the config schemas merged', true)
.option('--no-merged', 'Print the config schemas not merged')
.description('Print configuration schema')
.action(lazy(() => import('./config/schema').then(m => m.default)));