You can write and install plugins to build on the default ac commands, allowing you to perform new and more complex tasks with ACP CLI and ACP platform integration.
You can write a plugin for ACP CLI (ac) in any programming language or script that allows you to write command-line commands. Note that you cannot use a plugin to overwrite an existing ac command.
This procedure creates a simple Bash plugin that prints a message to the terminal when the ac foo command is issued.
Procedure
Create a file called ac-foo. When naming your plugin file, keep the following in mind:
ac- or kubectl- to be recognized as a pluginac-foo-bar can be invoked by a command of ac foo barac-foo_bar can be invoked by a command of ac foo-barAdd the following contents to the file:
After you install this plugin for ACP CLI, it can be invoked using the ac foo command.
ac-<plugin-name> or kubectl-<plugin-name> naming patternAfter you write a custom plugin for ACP CLI, you must install the plugin before use.
ac- or kubectl-If necessary, update the plugin file to be executable:
Place the file anywhere in your PATH, such as /usr/local/bin/:
Run ac plugin list to make sure that the plugin is listed:
Example output
If your plugin is not listed here, verify that the file begins with ac- or kubectl-, is executable, and is on your PATH.
Invoke the new command or option introduced by the plugin.
For example, if you built and installed the ac-ns plugin, you can use the following command to view the current namespace:
Note that the command to invoke the plugin depends on the plugin file name. For example, a plugin with the file name of ac-foo-bar is invoked by the ac foo bar command.