How to use the @salesforce/command.core.Messages 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 / dependencies / componentizer.ts View on Github external
import {core, SfdxCommand} from '@salesforce/command';
import assert = require('assert');
import {join} from 'path';
import {ClusterPackager } from '../../../lib/clusterPackager';
import {ComponentGraph} from '../../../lib/componentGraph';
import {FileWriter} from '../../../lib/fileWriter';
import {Node, NodeGroup, ScalarNode } from '../../../lib/NodeDefs';

core.Messages.importMessagesDirectory(join(__dirname));
const messages = core.Messages.loadMessages('dependencies-cli', 'analyze');

export default class Analyze extends SfdxCommand {
    public static outputFolder = 'lib/';

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

    public static examples = [
    `sfdx andyinthecloud:dependencies:componentizer -u DevHub
    `
    ];

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

    // tslint:disable-next-line:no-any
    public static buildGraph(results: any, connectAuras: boolean = false, forwards: boolean = true, backwards: boolean = false): ComponentGraph {
        const graph: ComponentGraph = new ComponentGraph();
github msrivastav13 / mo-dx-plugin / src / commands / deploy / vfcomponent.ts View on Github external
import {core, flags, SfdxCommand} from '@salesforce/command';
import {AnyJson} from '@salesforce/ts-types';
import * as chalk from 'chalk';
import fs = require('fs-extra');
import {SobjectResult} from '../../models/sObjectResult';
import {Deploy, DeployResult} from '../../service/deploy';
import {display, displaylog} from '../../service/displayError';
import {getFileName} from '../../service/getFileName';
import {getNameSpacePrefix} from '../../service/getNamespacePrefix';

// Initialize Messages with the current plugin directory
core.Messages.importMessagesDirectory(__dirname);

// 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 ApexComponentDeploy extends SfdxCommand {

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

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

  protected static flagsConfig = {
    // flag with a value (-n, --name=VALUE)
    filepath: flags.string({ char: 'p', description: 'file path', required: true })
github msrivastav13 / mo-dx-plugin / src / commands / deploy / lwc.ts View on Github external
import {core, flags, SfdxCommand} from '@salesforce/command';
import {AnyJson} from '@salesforce/ts-types';
import * as chalk from 'chalk';
import fs = require('fs-extra');
import {SobjectResult} from '../../models/sObjectResult';
import {displaylog} from '../../service/displayError';
import {getNameSpacePrefix} from '../../service/getNamespacePrefix';

// Initialize Messages with the current plugin directory
core.Messages.importMessagesDirectory(__dirname);

// 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 LWCDeploy extends SfdxCommand {

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

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

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

  // Comment this out if your command does not require an org username
  protected static requiresUsername = true;
github msrivastav13 / mo-dx-plugin / src / commands / generate / packagexml.ts View on Github external
import { core, flags, SfdxCommand } from '@salesforce/command';
import chalk from 'chalk';
import {DescribeMetadataResult} from '../../models/describemetadataResult';
import {DescribeMetadata} from '../../service/packagexmlbuilder/describeMetadata';
import {MetadataMember} from '../../service/packagexmlbuilder/metadataMember';
import {PackageXmlTemplate} from '../../service/packagexmlbuilder/packagexmlTemplate';
import { integer } from '@oclif/parser/lib/flags';
// Initialize Messages with the current plugin directory
core.Messages.importMessagesDirectory(__dirname);

// 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 PackageXML extends SfdxCommand {

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

  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'}];
github billryoung / sfdx-wry-plugin / src / commands / wry / data / count.ts View on Github external
import {core, flags, SfdxCommand} from '@salesforce/command';
import fs = require('fs');

//import { Connection, ConnectionOptions, RequestInfo } from 'jsforce';


//const request = require('request');


// Initialize Messages with the current plugin directory
core.Messages.importMessagesDirectory(__dirname);

// 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('sfdx-wry-plugin', 'count');

export default class Stats extends SfdxCommand {

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

    public static examples = [
  `$ sfdx wry:data:count --targetusername myScratchOrg@example.com -o Account,Opportunity,User
Account: 14 records
Account.Vendor: 2 records
Account.Customer: 12 records
Opportunity: 38 records
User: 5 records
github msrivastav13 / mo-dx-plugin / src / commands / metadata / rename.ts View on Github external
import { core, flags, SfdxCommand } from '@salesforce/command';
import { AnyJson } from '@salesforce/ts-types';
import * as chalk from 'chalk';
import { SaveResult } from 'jsforce';

// Initialize Messages with the current plugin directory
core.Messages.importMessagesDirectory(__dirname);

const messages = core.Messages.loadMessages('mo-dx-plugin', 'org');

export default class RenameMetadata extends SfdxCommand {

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

  public static examples = [
    '$ sfdx metadata:rename -t  -n  -o ',
    '$ sfdx metadata:rename -t CustomObject -n MyCustomObject1New__c -o MyCustomObject1__c'
  ];

  protected static flagsConfig = {
    // flag with a value (-n, --name=VALUE)
    metadatatype: flags.string({
      required: true,
      char: 't',
      description: 'type of the metadata. Examples are CustomObject, Profile'
github stomita / sfdx-migration-automatic / src / commands / automig / dump.ts View on Github external
import {core, flags, SfdxCommand} from '@salesforce/command';
import { fs } from '@salesforce/core';
import {AnyJson} from '@salesforce/ts-types';
import {readFile, writeFile} from 'fs-extra';
import {Connection} from 'jsforce';
import * as path from 'path';
import {AutoMigrator, DumpQuery} from 'salesforce-migration-automatic';

// Initialize Messages with the current plugin directory
core.Messages.importMessagesDirectory(__dirname);

// 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('sfdx-migration-automatic', 'dump');

export default class Dump extends SfdxCommand {

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

  public static get usage() {
    return SfdxCommand.usage.replace('<%= command.id %>', 'automig:dump');
  }

  public static examples = [
  '$ sfdx automig:dump --targetusername username@example.com --objects Opportunity,Case,Account:related,Task:related --outputdir ./dump',
  '$ sfdx automig:dump --targetusername username@example.com --config automig-dump-config.json'
  ];

  protected static flagsConfig = {
    // flag with a value (-n, --name=VALUE)
github msrivastav13 / mo-dx-plugin / src / commands / deploy / staticresource.ts View on Github external
import { core, flags, SfdxCommand } from "@salesforce/command";
import { AnyJson } from "@salesforce/ts-types";
import * as AdmZip from "adm-zip";
import * as chalk from 'chalk';
import fs = require("fs-extra");
import * as Mime from "mime-types";
import { displaylog } from "../../service/displayError";
import { getNameSpacePrefix } from "../../service/getNamespacePrefix";

// Initialize Messages with the current plugin directory
core.Messages.importMessagesDirectory(__dirname);

// 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 StaticResourceDeploy extends SfdxCommand {
  public static description = messages.getMessage("staticresourceDeploy");

  public static examples = [
    "$ sfdx deploy:staticresource -p ",
    "$ sfdx deploy:staticresource -p  --cachecontrol public",
    "$ sfdx deploy:staticresource -p  --cachecontrol public --resourcefolder "
  ];

  protected static flagsConfig = {
    // flag with a value (-n, --name=VALUE)
    filepath: flags.string({
      char: "p",
      description: "file path of the resource bundle"
    }),
github afawcett / dependencies-cli / src / commands / andyinthecloud / dependencies / report.ts View on Github external
import {core, flags, SfdxCommand } from '@salesforce/command';
import process = require('child_process');
import {ClusterPackager} from '../../../lib/clusterPackager';
import {DependencyGraph} from '../../../lib/dependencyGraph';
import {FileWriter} from '../../../lib/fileWriter';
import {MetadataComponentDependency, Node} from '../../../lib/NodeDefs';
import {Member, PackageMerger} from '../../../lib/PackageMerger';

core.Messages.importMessagesDirectory(__dirname);
const messages = core.Messages.loadMessages('dependencies-cli', 'depends');

export default class Report extends SfdxCommand {
  public static description = messages.getMessage('description');
  public static examples = [messages.getMessage('example1')];

  protected static flagsConfig = {
    resultformat: flags.string({ char: 'r', description: messages.getMessage('resultformatFlagDescription'), default: 'dot', options: ['dot', 'xml'] }),
    includelist: flags.string({char: 'i', description: messages.getMessage('includeListDescription')}),
    excludelist: flags.string({char: 'e', description: messages.getMessage('excludeListDescription')}),
    outputdir: flags.string({char: 'd', description: messages.getMessage('outputDirDescription')}),
    generatemanifest: flags.boolean({char: 'm', description: messages.getMessage('generateManifestDescription')}),
    excludepackagefile: flags.string({
      char: 'x',
      description: messages.getMessage('excludePackageDescription'),
      dependsOn: ['generatemanifest']
    }),
github amtrack / sfdx-browserforce-plugin / src / browserforceCommand.ts View on Github external
import { core, flags, SfdxCommand } from '@salesforce/command';
import * as path from 'path';
import Browserforce from './browserforce';
import ConfigParser from './config-parser';
import * as DRIVERS from './plugins';

core.Messages.importMessagesDirectory(__dirname);
const messages = core.Messages.loadMessages(
  'sfdx-browserforce-plugin',
  'browserforce'
);

export default class BrowserforceCommand extends SfdxCommand {
  protected static requiresUsername = true;

  protected static flagsConfig = {
    definitionfile: flags.string({
      char: 'f',
      description: messages.getMessage('definitionFileDescription')
    }),
    planfile: flags.string({
      char: 'p',
      name: 'plan',
      description: messages.getMessage('planFileDescription')