Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: add flags-dir base flag #519

Merged
merged 1 commit into from
Mar 22, 2024
Merged

feat!: add flags-dir base flag #519

merged 1 commit into from
Mar 22, 2024

Conversation

mdonnalley
Copy link
Contributor

@mdonnalley mdonnalley commented Mar 19, 2024

Add --flags-dir as a base flag for all commands that extend SfCommand

Breaking change because abstract classes that extend SfCommand and define baseFlags will fail typescript compilation. Solution is to spread SfCommand.baseFlags onto your abstract class' baseFlags. Example

// src/base-command.ts
import {SfCommand, Flags} from '@salesforce/sf-plugins-core'

export abstract class BaseCommand extends SfCommand {
  public static baseFlags = {
    ...SfCommand.baseFlags,
    'global-flag': Flags.boolean()
  } 
}


// src/commands/my-command.ts
import {BaseCommand} from '../base-command.ts'
import {Flags} from '@salesforce/sf-plugins-core'

export default class MyCommand extends BaseCommand {
  public static flags = {
    'my-flag': Flags.boolean()
  }

  public async run(): Promise<void> {
    // do stuff
  }
}

Needs salesforcecli/plugin-data#864 for external nuts to pass

@W-15213828@

BREAKING CHANGE: SfCommand.baseFlags may cause compilation errors
@mdonnalley mdonnalley changed the title feat: add flags-dir base flag feat!: add flags-dir base flag Mar 20, 2024
@mshanemc mshanemc merged commit c8fd443 into main Mar 22, 2024
44 of 46 checks passed
@mshanemc mshanemc deleted the mdonnalley/flags-dir branch March 22, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants