Merge pull request #33181 from backstage/rugvip/cli-boolean-flag-negation

cli: enable --no- prefix negation for boolean flags
This commit is contained in:
Patrik Oldsberg
2026-03-10 18:27:53 +01:00
committed by GitHub
32 changed files with 33 additions and 12 deletions
+1 -1
View File
@@ -81,7 +81,7 @@
"buffer": "^6.0.3",
"chalk": "^4.0.0",
"chokidar": "^3.3.1",
"cleye": "^2.2.1",
"cleye": "^2.3.0",
"commander": "^14.0.3",
"cross-fetch": "^4.0.0",
"cross-spawn": "^7.0.3",
@@ -38,6 +38,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: { ...info, usage: `${info.usage} <workspace-dir> [packages...]` },
booleanFlagNegation: true,
parameters: ['<workspace-dir>', '[packages...]'],
flags: {
alwaysPack: {
@@ -44,6 +44,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
role: {
type: String,
@@ -20,7 +20,7 @@ import { targetPaths } from '@backstage/cli-common';
import type { CommandContext } from '../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
cli({ help: info }, undefined, args);
cli({ help: info, booleanFlagNegation: true }, undefined, args);
await fs.remove(targetPaths.resolve('dist'));
await fs.remove(targetPaths.resolve('dist-types'));
await fs.remove(targetPaths.resolve('coverage'));
@@ -20,6 +20,6 @@ import { revertProductionPack } from '../../lib/packager/productionPack';
import type { CommandContext } from '../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
cli({ help: info }, undefined, args);
cli({ help: info, booleanFlagNegation: true }, undefined, args);
await revertProductionPack(targetPaths.dir);
};
@@ -23,7 +23,7 @@ import { createTypeDistProject } from '../../lib/typeDistProject';
import type { CommandContext } from '../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
cli({ help: info }, undefined, args);
cli({ help: info, booleanFlagNegation: true }, undefined, args);
publishPreflightCheck({
dir: targetPaths.dir,
@@ -36,6 +36,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
config: {
type: [String],
@@ -37,6 +37,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
all: {
type: Boolean,
@@ -22,7 +22,7 @@ import { run, targetPaths } from '@backstage/cli-common';
import type { CommandContext } from '../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
cli({ help: info }, undefined, args);
cli({ help: info, booleanFlagNegation: true }, undefined, args);
const packages = await PackageGraph.listTargetPackages();
await fs.remove(targetPaths.resolveRoot('dist'));
@@ -42,6 +42,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: { ...info, usage: `${info.usage} [packages...]` },
booleanFlagNegation: true,
parameters: ['[packages...]'],
flags: {
plugin: {
@@ -31,6 +31,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
package: {
type: String,
@@ -27,6 +27,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
package: { type: String, description: 'Package to print config for' },
lax: {
@@ -28,6 +28,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
package: { type: String, description: 'Package to print schema for' },
format: { type: String, description: 'Output format (yaml or json)' },
@@ -24,6 +24,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
package: {
type: String,
@@ -32,6 +32,7 @@ export default async ({ args, info }: CommandContext) => {
const { _: positionals } = cli(
{
help: { ...info, usage: `${info.usage} <github-org>` },
booleanFlagNegation: true,
parameters: ['<github-org>'],
},
undefined,
@@ -58,6 +58,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
include: {
type: [String],
@@ -27,6 +27,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: { ...info, usage: `${info.usage} [directories...]` },
booleanFlagNegation: true,
parameters: ['[directories...]'],
flags: {
fix: {
@@ -66,6 +66,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
fix: {
type: Boolean,
@@ -501,6 +501,7 @@ export default async ({
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
publish: {
type: Boolean,
@@ -28,6 +28,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
json: { type: Boolean, description: 'Output as JSON' },
},
@@ -18,7 +18,7 @@ import { cli } from 'cleye';
import type { CommandContext } from '../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
cli({ help: info }, undefined, args);
cli({ help: info, booleanFlagNegation: true }, undefined, args);
throw new Error(
'The `migrate package-exports` command has been removed, use `repo fix` instead.',
);
@@ -24,7 +24,7 @@ import type { CommandContext } from '../../../wiring/types';
const PREFIX = `module.exports = require('@backstage/cli/config/eslint-factory')`;
export default async ({ args, info }: CommandContext) => {
cli({ help: info }, undefined, args);
cli({ help: info, booleanFlagNegation: true }, undefined, args);
const packages = await PackageGraph.listTargetPackages();
const oldConfigs = [
@@ -23,7 +23,7 @@ import { targetPaths } from '@backstage/cli-common';
import type { CommandContext } from '../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
cli({ help: info }, undefined, args);
cli({ help: info, booleanFlagNegation: true }, undefined, args);
const { packages } = await getPackages(targetPaths.dir);
await Promise.all(
@@ -25,7 +25,7 @@ const configArgPattern = /--config[=\s][^\s$]+/;
const noStartRoles: PackageRole[] = ['cli', 'common-library'];
export default async ({ args, info }: CommandContext) => {
cli({ help: info }, undefined, args);
cli({ help: info, booleanFlagNegation: true }, undefined, args);
const packages = await PackageGraph.listTargetPackages();
await Promise.all(
@@ -24,7 +24,7 @@ const REACT_ROUTER_DEPS = ['react-router', 'react-router-dom'];
const REACT_ROUTER_RANGE = '6.0.0-beta.0 || ^6.3.0';
export default async ({ args, info }: CommandContext) => {
cli({ help: info }, undefined, args);
cli({ help: info, booleanFlagNegation: true }, undefined, args);
const packages = await PackageGraph.listTargetPackages();
await Promise.all(
@@ -80,6 +80,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
pattern: {
type: String,
@@ -45,6 +45,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
pattern: {
type: String,
@@ -41,6 +41,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
select: {
type: String,
@@ -147,6 +147,7 @@ export default async ({ args, info }: CommandContext) => {
const { flags: opts } = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
since: {
type: String,
@@ -41,6 +41,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
output: {
type: String,
@@ -47,6 +47,7 @@ export default async ({ args, info }: CommandContext) => {
} = cli(
{
help: info,
booleanFlagNegation: true,
flags: {
input: {
type: String,