How to use the @salesforce/ function in @salesforce/command

To help you get started, we’ve selected a few @salesforce/command examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github afawcett / dependencies-cli / src / commands / andyinthecloud / manifests / merge.ts View on Github external
import {flags, SfdxCommand} from '@salesforce/command';
import {ClusterPackager} from '../../../lib/clusterPackager';
import { FileWriter } from '../../../lib/fileWriter';
import {Member, PackageMerger} from '../../../lib/packageMerger';

export default class PackageMerging extends SfdxCommand {

  public static description = 'This tool allows you to merge several package.xmls together to create one base package.xml.' +
  'You can put the file names (including paths) to the package.xmls as args (as many as you want) and the base package.xml will be outputted to the console.';

  public static strict = false;

  public static flagsConfig = {
    help:{char: 'h', description: 'get some help'}),
    outputdirectory: flags.string({char: 'd', description: 'output folder location to put package.xml'})
    // flag with no value (-f, --force)

  public async run(): Promise<string> {

    const fileArray = new Array<Map<string, Member[]>>();
    let cont = false;
    for (const file of this.argv) {
      if (file === '-d' || file === '--outputdir') { // TODO: Find a better way to get args and flags
        cont = true; // Skip next arg also
      if (cont) {
        cont = false;