From 192ce0018046d129135f761f04931d369f3c2a17 Mon Sep 17 00:00:00 2001 From: David First Date: Wed, 6 Mar 2024 12:58:50 -0500 Subject: [PATCH 1/2] improve help of patterns to mention the filter-by-state --- scopes/component/remove/remove-cmd.ts | 7 +++++++ src/constants.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/scopes/component/remove/remove-cmd.ts b/scopes/component/remove/remove-cmd.ts index abf87ed11c63..24a71e3e933f 100644 --- a/scopes/component/remove/remove-cmd.ts +++ b/scopes/component/remove/remove-cmd.ts @@ -7,6 +7,7 @@ import { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants'; import { RemovedLocalObjects } from './removed-local-objects'; import { RemoveMain } from './remove.main.runtime'; import { removeTemplate } from './remove-template'; +import { Example } from '../../../dist/cli/command'; export class RemoveCmd implements Command { name = 'remove '; @@ -33,6 +34,12 @@ export class RemoveCmd implements Command { ['s', 'silent', 'skip confirmation'], ] as CommandOptions; loader = true; + examples = [ + { + cmd: 'remove "$deprecated"', + description: 'remove all components that are deprecated', + }, + ]; remoteOp = true; constructor(private remove: RemoveMain, private workspace?: Workspace) {} diff --git a/src/constants.ts b/src/constants.ts index e2618644c49c..c457a9425e6e 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -542,6 +542,7 @@ export const WILDCARD_HELP = (command: string) => export const PATTERN_HELP = (command: string) => `you can use a \`\` for multiple component ids, such as \`bit ${command} "org.scope/utils/**"\`. use comma to separate patterns and '!' to exclude. e.g. 'ui/**, !ui/button' +use '$' prefix to filter by states/attributes, e.g. '$deprecated' or '$modified'. always wrap the pattern with single quotes to avoid collision with shell commands. use \`bit pattern --help\` to understand patterns better and \`bit pattern \` to validate the pattern. `; From a3515d6dc695d6d6d9e08d75e5174eb9da0d8bb4 Mon Sep 17 00:00:00 2001 From: David First Date: Wed, 6 Mar 2024 13:15:37 -0500 Subject: [PATCH 2/2] fix lint --- scopes/component/remove/remove-cmd.ts | 1 - src/constants.ts | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scopes/component/remove/remove-cmd.ts b/scopes/component/remove/remove-cmd.ts index 24a71e3e933f..2ee71d8fcb17 100644 --- a/scopes/component/remove/remove-cmd.ts +++ b/scopes/component/remove/remove-cmd.ts @@ -7,7 +7,6 @@ import { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants'; import { RemovedLocalObjects } from './removed-local-objects'; import { RemoveMain } from './remove.main.runtime'; import { removeTemplate } from './remove-template'; -import { Example } from '../../../dist/cli/command'; export class RemoveCmd implements Command { name = 'remove '; diff --git a/src/constants.ts b/src/constants.ts index c457a9425e6e..4c64eff14881 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -542,13 +542,14 @@ export const WILDCARD_HELP = (command: string) => export const PATTERN_HELP = (command: string) => `you can use a \`\` for multiple component ids, such as \`bit ${command} "org.scope/utils/**"\`. use comma to separate patterns and '!' to exclude. e.g. 'ui/**, !ui/button' -use '$' prefix to filter by states/attributes, e.g. '$deprecated' or '$modified'. +use '$' prefix to filter by states/attributes, e.g. '$deprecated', '$modified' or '$env:teambit.react/react'. always wrap the pattern with single quotes to avoid collision with shell commands. use \`bit pattern --help\` to understand patterns better and \`bit pattern \` to validate the pattern. `; export const COMPONENT_PATTERN_HELP = `component name, component id, or component pattern. use component pattern to select multiple components. wrap the pattern with quotes. use comma to separate patterns and "!" to exclude. e.g. "ui/**, !ui/button". +use '$' prefix to filter by states/attributes, e.g. '$deprecated', '$modified' or '$env:teambit.react/react'. use \`bit pattern --help\` to understand patterns better and \`bit pattern \` to validate the pattern.`; export const CURRENT_UPSTREAM = 'current';