Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add section name to command keywords #144

Merged
merged 2 commits into from
Dec 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/action/ActionImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ interface ActionImplOptions {
history?: History;
}

/**
* Extends the configured keywords to include the section
* This allows section names to be searched for.
*/
const extendKeywords = ({ keywords = "", section = "" }: Action): string => {
return `${keywords} ${section}`.trim();
};

export class ActionImpl implements Action {
id: Action["id"];
name: Action["name"];
Expand All @@ -31,6 +39,7 @@ export class ActionImpl implements Action {
Object.assign(this, action);
this.id = action.id;
this.name = action.name;
this.keywords = extendKeywords(action);
const perform = action.perform;
this.command =
perform &&
Expand Down