diff --git a/src/generators/app.ts b/src/generators/app.ts index d7176ef..c235346 100644 --- a/src/generators/app.ts +++ b/src/generators/app.ts @@ -648,8 +648,8 @@ class App extends Generator { {...opts, name: sfdxExampleCommand, topic}) } - if (!fs.existsSync('messages/messages.json')) { - this.fs.copyTpl(this.templatePath('messages/messages.json'), this.destinationPath(`messages/${sfdxExampleCommand}.json`), this) + if (!fs.existsSync('messages/messages.js')) { + this.fs.copyTpl(this.templatePath('messages/messages.js'), this.destinationPath(`messages/${sfdxExampleCommand}.js`), this) } if (!fs.existsSync('.vscode/launch.json')) { diff --git a/templates/messages/messages.js b/templates/messages/messages.js new file mode 100644 index 0000000..c427393 --- /dev/null +++ b/templates/messages/messages.js @@ -0,0 +1,13 @@ +module.exports = { + commandDescription: "print a greeting and your org IDs", + nameFlagDescription: "name to print", + forceFlagDescription: "example boolean flag", + errorNoOrgResults: "No results found for the org '%s'.", + example1: `$ sfdx hello:org --targetusername myOrg@example.com --targetdevhubusername devhub@org.com +Hello world! This is org: MyOrg and I will be around until Tue Mar 20 2018! +My hub org id is: 00Dxx000000001234 + `, + example2: `$ sfdx hello:org --name myname --targetusername myOrg@example.com + Hello myname! This is org: MyOrg and I will be around until Tue Mar 20 2018! + `, +}; diff --git a/templates/messages/messages.json b/templates/messages/messages.json deleted file mode 100644 index b5c9eec..0000000 --- a/templates/messages/messages.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "commandDescription": "print a greeting and your org IDs", - "nameFlagDescription": "name to print", - "forceFlagDescription": "example boolean flag", - "errorNoOrgResults": "No results found for the org '%s'." -} diff --git a/templates/src/sfdxCommand.ts.ejs b/templates/src/sfdxCommand.ts.ejs index bdbf0bd..85ba5b6 100644 --- a/templates/src/sfdxCommand.ts.ejs +++ b/templates/src/sfdxCommand.ts.ejs @@ -20,13 +20,7 @@ export default class <%- klass %> extends SfdxCommand { public static description = messages.getMessage('commandDescription'); public static examples = [ - `$ sfdx <%- topicName %>:<%- commandName %> --targetusername myOrg@example.com --targetdevhubusername devhub@org.com -Hello world! This is org: MyOrg and I will be around until Tue Mar 20 2018! -My hub org id is: 00Dxx000000001234 - `, - `$ sfdx <%- topicName %>:<%- commandName %> --name myname --targetusername myOrg@example.com -Hello myname! This is org: MyOrg and I will be around until Tue Mar 20 2018! - `, + messages.getMessage('example1'),messages.getMessage('example2'), ]; public static args = [{ name: 'file' }];