refactor(commands): commands now store all info about themselves
Makes it easier to modify a command
Each command exports an object:
{
directive: string or array of commands that call this handler
handler: function to process the command
syntax: string of how to call the command
description: human readable explaination of command
flags: optional object of flags
}
This commit is contained in:
11
src/commands/registration/cdup.js
Normal file
11
src/commands/registration/cdup.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const cwd = require('./cwd').handler;
|
||||
|
||||
module.exports = {
|
||||
directive: ['CDUP', 'XCUP'],
|
||||
handler: function(args) {
|
||||
args.command._ = [args.command._[0], '..'];
|
||||
return cwd.call(this, args);
|
||||
},
|
||||
syntax: '{{cmd}}',
|
||||
description: 'Change to Parent Directory'
|
||||
}
|
||||
Reference in New Issue
Block a user