Skip to content

Commit

Permalink
Added option 'generator-description'.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennykorsukewitz committed Jan 3, 2024
1 parent 9b18325 commit 5604153
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
7 changes: 0 additions & 7 deletions generators/app/USAGE
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,3 @@ Example:
messages/install.txt default install.txt file
messages/version.txt default version.txt file
messages.json default messages.json file

Variables:
sublime_version
package_name
package_description
github_username
github_fullname
15 changes: 15 additions & 0 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ const prompts = [];

module.exports = class extends Generator {

// Arguments and options should be defined in the constructor.
constructor(args, opts) {
super(args, opts);

// This method adds support for a `--generator-description` flag
this.option('generator-description', {
type: Boolean,
description: 'Shows the description of each sub-generator.',
default: false,
alias: 'd',
hide: false,
});

}

// initializing - Your initialization methods (checking current project state, getting configs, etc)
async initializing() {

Expand Down
2 changes: 1 addition & 1 deletion generators/macro/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const config = {
name: 'Macro',
description: 'Creates a Default.sublime-macro file. Macros are a basic automation facility comprising sequences of commands. Use them whenever you need to repeat the exact same steps to perform an operation.',
description: 'Creates a Default.sublime-macro file. Macros are a basic automation facility comprising sequences of commands.',
priority: 60,
versions: {
'4.0.x': '',
Expand Down
2 changes: 1 addition & 1 deletion generators/mousemap/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const config = {
name: 'Mousemap',
description: 'Creates a Default.sublime-mousemap file. The mousemap files (which have the extension .sublime-mousemap) control what commands are executed when a user performs an action with a mouse, e.g. clicking a mouse button, scrolling the scroll wheel, etc.',
description: 'Creates a Default.sublime-mousemap file, which control what commands are executed when a user performs an action with a mouse.',
priority: 80,
versions: {
'4.0.x': '',
Expand Down
7 changes: 6 additions & 1 deletion src/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ async function GetsupportedVersions(Generator, config) {

const generator_name = generator_config.name || changeCase.capitalCase(generator);

let name = generator_name;
if (Generator.options['generator-description']) {
name = generator_name + ' \t - ' + generator_config.description;
}

const generator_data = {
name: generator_name + ' \t - ' + generator_config.description,
name: name,
description: generator_config.description,
value: generator,
checked: false,
Expand Down

0 comments on commit 5604153

Please sign in to comment.