Skip to content

Commit 75c41e6

Browse files
committed
Fix for method help
1 parent 52056b2 commit 75c41e6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/shell-api/src/database.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ describe('Database', () => {
1616
expect(apiClass.help().shellApiType()).to.equal('Help');
1717
expect(apiClass.help.shellApiType()).to.equal('Help');
1818
});
19+
it('calls help function for methods', () => {
20+
expect(apiClass.runCommand.help().shellApiType()).to.equal('Help');
21+
expect(apiClass.runCommand.help.shellApiType()).to.equal('Help');
22+
});
1923
});
2024
describe('collections', () => {
2125
it('allows to get a collection as property if is not one of the existing methods', () => {

packages/shell-api/src/decorators.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,16 @@ export function shellApiClassDefault(constructor: Function): void {
8181
};
8282

8383
const attributeHelpKeyPrefix = `${classHelpKeyPrefix}.attributes.${propertyName}`;
84-
descriptor.value.help = {
84+
const attrHelp = {
8585
help: `${attributeHelpKeyPrefix}.example`,
8686
docs: `${attributeHelpKeyPrefix}.link`,
8787
attr: [
8888
{ description: `${attributeHelpKeyPrefix}.description` }
8989
]
9090
};
91+
const aHelp = new Help(attrHelp);
92+
descriptor.value.help = (): Help => (aHelp);
93+
Object.setPrototypeOf(descriptor.value.help, aHelp);
9194

9295
classHelp.attr.push({
9396
name: propertyName,

0 commit comments

Comments
 (0)