mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-27 10:32:58 +02:00
53 lines
615 B
JavaScript
53 lines
615 B
JavaScript
class BaseCommand {
|
|
|
|
usage() {
|
|
throw new Error('Usage not defined');
|
|
}
|
|
|
|
description() {
|
|
throw new Error('Description not defined');
|
|
}
|
|
|
|
async action(args) {
|
|
throw new Error('Action not defined');
|
|
}
|
|
|
|
aliases() {
|
|
return [];
|
|
}
|
|
|
|
options() {
|
|
return [];
|
|
}
|
|
|
|
hidden() {
|
|
return false;
|
|
}
|
|
|
|
enabled() {
|
|
return true;
|
|
}
|
|
|
|
cancellable() {
|
|
return false;
|
|
}
|
|
|
|
async cancel() {}
|
|
|
|
name() {
|
|
let r = this.usage().split(' ');
|
|
return r[0];
|
|
}
|
|
|
|
metadata() {
|
|
return {
|
|
name: this.name(),
|
|
usage: this.usage(),
|
|
options: this.options(),
|
|
hidden: this.hidden(),
|
|
};
|
|
}
|
|
|
|
}
|
|
|
|
export { BaseCommand }; |