Created
December 13, 2013 16:34
-
-
Save etexier/7947015 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| command.summary=Register or unregister custom App Builder commands | |
| command.options=[-v] [-u <commandName>] [[-i] <sourceFile>] | |
| command.description=\n \ | |
| You can write your own custom commands to use with the App Builder. \n \ | |
| Once you have created the source file with the custom commands, \n \ | |
| register the file with the App Builder by specifying the path or URL \n \ | |
| for the file.\n \ | |
| \n \ | |
| You also use the register command to unregister a previously registered \n \ | |
| command by passing the -u option and the command.\n \ | |
| \n \ | |
| @|UNDERLINE Sample Code|@\n \ | |
| \n \ | |
| package com.magnet.tools.cli.test\n \ | |
| \n \ | |
| import com.magnet.tools.cli.AbstractCommand\n \ | |
| import com.magnet.tools.cli.Constants\n \ | |
| \n \ | |
| class TestCommand extends AbstractCommand {\n \ | |
| \n \ | |
| TestCommand() {\n \ | |
| // set name, usage, and short help)\n \ | |
| super('test-command', 'test-command -v', 'this is test command')\n \ | |
| }\n \ | |
| \n \ | |
| @Override\n \ | |
| def execute(List<String> args) {\n \ | |
| writer.println("this is a test command with arguments ${args}")\n \ | |
| return Constants.COMMAND_OK_CODE\n \ | |
| }\n \ | |
| }\n \ | |
| \n \ | |
| @|UNDERLINE Options|@\n \ | |
| \n \ | |
| @|BOLD -v | --verbose|@ \n \ | |
| Enable verbose mode to show more details.\n \ | |
| \n \ | |
| @|BOLD -u | --uninstall <commandName>|@ \n \ | |
| Unregister the command with name <commandName>.\n \ | |
| \n \ | |
| @|BOLD -i | --install <sourcelocation>|@ \n \ | |
| Install the command with source <sourceLocation>\n \ | |
| Where <sourceLocation> is the URL or path to the file with the source\n \ | |
| code for the custom commands.\n \ | |
| \n \ | |
| @|UNDERLINE Examples|@\n \ | |
| \n \ | |
| - Register a new command:\n \ | |
| \n \ | |
| register http://www.examples.com/mab/command/MyCommand.txt\n \ | |
| \n \ | |
| - Unregister the command 'my-command'\n \ | |
| \n \ | |
| register -u my-command \n \ | |
| \n \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment