How to use the @salesforce/command.flags.string 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 wadewegner / sfdx-waw-plugin / src / commands / waw / connectedapp / create.ts View on Github external
description: messages.getMessage('connectedapp.create.flags.certificate')
    }),
    callbackurl: flags.string({
      char: 'c',
      description: messages.getMessage('connectedapp.create.flags.callbackurl')
    }),
    description: flags.string({
      char: 'd',
      description: messages.getMessage('connectedapp.create.flags.description')
    }),
    scopes: flags.string({
      // Basic,Api,Web,Full,Chatter,CustomApplications,RefreshToken,OpenID,CustomPermissions,Wave,Eclair
      char: 's',
      description: messages.getMessage('connectedapp.create.flags.scopes')
    }),
    contactemail: flags.string({
      char: 'e',
      description: messages.getMessage('connectedapp.create.flags.contactemail')
    })
  };

  protected static requiresUsername = true;

  public async run(): Promise<SaveResult | MetadataInfo> {
    const username = this.org.getUsername();
    const fullName = this.flags.name;
    const label = this.flags.label || fullName;
    const contactEmail = this.flags.contactemail || username;
    const callbackUrl = this.flags.callbackurl || 'sfdx://success';
    const createCerts = this.flags.certificate;
    const description = this.flags.description || 'generated by waw:connectedapp:create';
    const scopes = this.flags.scopes && this.flags.scopes.split(',') || ['Basic', 'Api', 'Web', 'RefreshToken'];
github wadewegner / sfdx-waw-plugin / src / commands / waw / connectedapp / create.ts View on Github external
char: 'l',
      description: messages.getMessage('connectedapp.create.flags.label')
    }),
    certificate: flags.boolean({
      char: 'r',
      description: messages.getMessage('connectedapp.create.flags.certificate')
    }),
    callbackurl: flags.string({
      char: 'c',
      description: messages.getMessage('connectedapp.create.flags.callbackurl')
    }),
    description: flags.string({
      char: 'd',
      description: messages.getMessage('connectedapp.create.flags.description')
    }),
    scopes: flags.string({
      // Basic,Api,Web,Full,Chatter,CustomApplications,RefreshToken,OpenID,CustomPermissions,Wave,Eclair
      char: 's',
      description: messages.getMessage('connectedapp.create.flags.scopes')
    }),
    contactemail: flags.string({
      char: 'e',
      description: messages.getMessage('connectedapp.create.flags.contactemail')
    })
  };

  protected static requiresUsername = true;

  public async run(): Promise<SaveResult | MetadataInfo> {
    const username = this.org.getUsername();
    const fullName = this.flags.name;
    const label = this.flags.label || fullName;
github msrivastav13 / mo-dx-plugin / src / commands / retrieve / pkgsource.ts View on Github external
public static examples = [
    '$ sfdx retrieve:pkgsource -n <package/changeset>',
    '$ sfdx retrieve:pkgsource -n <package/changeset> -r <relative path where source is retrieved and unzipped>',
    '$ sfdx retrieve:pkgsource -n <package/changeset> -r /changesets/src'
  ];

  protected static flagsConfig = {
    // flag with a value (-n, --name=VALUE)
    packagename: flags.string({
      required: true,
      char: 'n',
      description: 'the name of the package you want to retrieve'
    }),

    retrievedir : flags.string({
      required: false,
      char: 'r',
      description: 'directory path to retrieve'
    })
  };
  // Comment this out if your command does not require an org username
  protected static requiresUsername = true;

  // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
  protected static requiresProject = true;

  public async run(): Promise<AnyJson> {
    const defaultusername = this.flags.targetusername
      ? this.flags.targetusername
      : this.org.getUsername();
    const tmpDir = this.flags.retrievedir ? this.flags.retrievedir : 'src' ;
github msrivastav13 / mo-dx-plugin / src / commands / retrieve / dxsource.ts View on Github external
'$ sfdx retrieve:dxsource -u myOrg@example.com -n <package/changeset> -p <[pathName]>'
  ];

  protected static flagsConfig = {
    // flag with a value (-n, --name=VALUE)
    packagename: flags.string({
      required: true,
      char: 'n',
      description: 'the name of the package you want to retrieve'
    }),
    pathname: flags.string({
      char: 'p',
      default: 'force-app',
      description: 'where to convert the result to.defaults to force-app'
    }),
    retainmetadata: flags.string({
      char: 'm',
      description:
        'If set retain the metadata folder in mdapiout directory and do not clean'
    })
  };

  // Comment this out if your command does not require an org username
  protected static requiresUsername = true;

  // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
  protected static requiresProject = true;

  public async run(): Promise<AnyJson> {
    const target = this.flags.pathname;
    const defaultusername = this.flags.targetusername
      ? this.flags.targetusername
github msrivastav13 / mo-dx-plugin / src / commands / deploy / aura.ts View on Github external
// Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
// or any library that is using the messages framework can also be loaded this way.
const messages = core.Messages.loadMessages('mo-dx-plugin', 'org');

export default class AuraDeploy extends SfdxCommand {

  public static description = messages.getMessage('auraDeploy');

  public static examples = [
  '$ sfdx deploy:aura -p filepath'
  ];

  protected static flagsConfig = {
    // flag with a value (-n, --name=VALUE)
    filepath: flags.string({ char: 'p', description: 'file path', required: true })
  };

  // Comment this out if your command does not require an org username
  protected static requiresUsername = true;

  // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
  protected static requiresProject = true;

  public async run(): Promise<AnyJson> {

    this.ux.startSpinner(chalk.bold.yellowBright('Saving'));

    const conn = this.org.getConnection();

    const namespacePrefix = await getNameSpacePrefix(conn);
github eltoroit / ETCopyData / src / @ELTOROIT / ETCopyData.ts View on Github external
orgs: Map<WhichOrg, OrgManager>;
}

export class ETCopyData {
	public static flagsConfig = {
		configfolder: flags.string({
			char: "c",
			description: "Root folder to find the configuration file",
			helpValue: "PATH",
		}),
		orgdestination: flags.string({
			char: "d",
			description: "SFDX alias or username for the DESTINATION org",
			helpValue: "(alias|username)",
		}),
		orgsource: flags.string({
			char: "s",
			description: "SFDX alias or username for the SOURCE org",
			helpValue: "(alias|username)",
		}),
	};

	public static setLogs(params: OutputFlags<any>, ux: UX, processName: string) {
		// Set log level based on parameters
		if (!params.loglevel) {
			params.loglevel = "TRACE";
		}
		Util.setLogLevel(params.loglevel);
		Util.writeLog("Log level: " + params.loglevel, LogLevel.TRACE);
		if (Util.doesLogOutputsEachStep()) {
			Util.writeLog(`${processName} Process Started`, LogLevel.INFO);
github msrivastav13 / mo-dx-plugin / src / commands / retrieve / pkgsource.ts View on Github external
const messages = core.Messages.loadMessages('mo-dx-plugin', 'org');

const exec = util.promisify(child.exec);

export default class Pkgsource extends SfdxCommand {
  public static description = messages.getMessage('retrieveSource');

  public static examples = [
    '$ sfdx retrieve:pkgsource -n <package/changeset>',
    '$ sfdx retrieve:pkgsource -n <package/changeset> -r <relative path where source is retrieved and unzipped>',
    '$ sfdx retrieve:pkgsource -n <package/changeset> -r /changesets/src'
  ];

  protected static flagsConfig = {
    // flag with a value (-n, --name=VALUE)
    packagename: flags.string({
      required: true,
      char: 'n',
      description: 'the name of the package you want to retrieve'
    }),

    retrievedir : flags.string({
      required: false,
      char: 'r',
      description: 'directory path to retrieve'
    })
  };
  // Comment this out if your command does not require an org username
  protected static requiresUsername = true;

  // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
  protected static requiresProject = true;
github ChuckJonas / sfdx-git-packager / src / commands / git / package.ts View on Github external
public static examples = [
    '$ sfdx git:package -s my-awesome-feature -t master -d deploy/my-feature',
    '$ sfdx git:package -d deploy/my-feature',
    '$ sfdx git:package -s feature-b -d deploy/feature-b'
  ];

  // not sure what this does...
  public static args = [
    { name: 'file' }
  ];

  protected static flagsConfig = {
    // flag with a value (-n, --name=VALUE)
    sourceref: flags.string({ char: 's', description: messages.getMessage('fromBranchDescription'), default: 'head' }),
    targetref: flags.string({ char: 't', description: messages.getMessage('toBranchDescription'), default: 'master' }),
    outputdir: flags.string({ char: 'd', description: messages.getMessage('outputdirDescription'), required: true }),
    ignorewhitespace: flags.boolean({ char: 'w', description: messages.getMessage('ignoreWhitespace') }),
    purge: flags.boolean({ description: messages.getMessage('purgeDescription') }),
    nodelete: flags.boolean({ description: messages.getMessage('nodelete') }),
    force: flags.boolean({ char: 'f', description: messages.getMessage('force') })
  };

  // Comment this out if your command does not require an org username
  protected static requiresUsername = false;

  // Comment this out if your command does not support a hub org username
  protected static supportsDevhubUsername = false;

  // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
  protected static requiresProject = true;
github wadewegner / sfdx-waw-plugin / src / commands / waw / source / oss.ts View on Github external
char: 'r',
      description: messages.getMessage('source.oss.flags.repository'),
      required: true
    }),
    path: flags.string({
      char: 'p',
      description: messages.getMessage('source.oss.flags.path'),
      required: true
    }),
    branch: flags.string({
      char: 'b',
      description: messages.getMessage('source.oss.flags.branch'),
      default: 'master',
      exclusive: ['tag']
    }),
    tag: flags.string({
      char: 't',
      description: messages.getMessage('source.oss.flags.tag'),
      exclusive: ['branch']
    }),
    server: flags.string({
      char: 's',
      description: messages.getMessage('source.oss.flags.server'),
      default: 'github.com'
    })
  };

  protected static requiresProject = true;

  public async run(): Promise<AnyJson> {
    const targetPath = this.flags.path;
    const server = this.flags.server;
github msrivastav13 / mo-dx-plugin / src / commands / generate / packagexml.ts View on Github external
public static examples = [
    '$ sfdx generate:packagexml -m ApexClass',
    '$ sfdx generate:packagexml -m CustomObject',
    '$ sfdx generate:packagexml -m ApexClass:MyApexClass1,MyApexClass2'
  ];

  public static args = [{name: 'all'}];

  protected static flagsConfig = {
    metadatatype : flags.string({
      required: false,
      char: 'm',
      description: 'the name of the metadata you want the package.xml for'
    }),
    version : flags.string({
      required: false,
      char: 'v',
      description: 'overrides the version of the package.xml'
    })
  };

  protected static requiresProject = true;
  protected static requiresUsername = true;

  public async run(): Promise<string> {
    let packagexml: string ;
    const conn = this.org.getConnection();
    const apiVersion = this.flags.version ? this.flags.version : conn.getApiVersion();
    const defaultusername = this.flags.targetusername
      ? this.flags.targetusername
      : this.org.getUsername();