type that specifies the choice of authentication types
String type definition for properties of abstractRestClient that has a getter set. This can be safely used in a getter call as a variable for the abstractRestClient object.
The command response format type definition - currently only JSON or default (stdout/stderr) are supported.
The type of value that should be specified for an option by the user. "array": an array of space delimited strings "boolean": a switch - the user specifies: true "--option-name" or false: "--option-name false" "count" : accepting only whole numbers as input value "existingLocalFile": a file for which fs.existsSync returns true "json": a parseable JSON string "number" : accepting integers as input value "string" : string input that does not allow "" as a valid input value "stringOrEmpty" : allow string to be empty when defined
The command segment represents the "level" you are at in the command (for help generation)
type that specifies the choice of protocols
This type is here so that we can indicate an object from a require can be instantiated.
Command Segment type - either "group" or "command".
"group" implies no handler and should have children. Use groups to logically arrange portions of your CLI. "command" implies there is a handler and may or may not have children.
An type that defines a class constructor
This interface defines the constructor for a credential manager. This is used by the TypeScript compiler to verify that any class that wishes to be a Credential Manager adheres to the constructor arguments sent to it.
Your class will satisfy this interface when all the following are true:
This type corresponds to the extenders.json
file stored in the CLI home directory.
Here is an example structure of what extenders.json
could look like on disk:
{
"profileTypes": {
"banana": {
"from": ["@zowe/banana-for-zowe-cli", "Zowe Explorer Banana Extension"],
"version": "v1.1.0",
"latestFrom": "Zowe Explorer Banana Extension"
}
}
}
All of the Default Imperative classes that can be changed by your Imperative CLI app.
A plugin can also define overrides through the same means as an Imperative CLI app. When additional overrides provided by plugins are present, Imperative will favor those classes over ones provided by your application.
Whether you are defining an Imperative Plugin or an Imperative CLI app, all keys in this object are expected to be a class constructor or of type string.
require('package-name')
)When defining the location of an overrides as a string, it must adhere to the following format. Otherwise Imperative will not be able to load the class.
Exporting an Anonymous Class
export = class {
// Code goes here
};
Exporting a Named Class
export = class YourOverridesClass {
// Code goes here
};
Using module.exports
(Not preferred for TypeScript Users)
class YourOverridesClass {
// Code goes here
}
module.exports = YourOverridesClass;
The value for the argument
The type of data for this property
Definition for a promise rejection method that provides an ImperativeError (or subclass)
Indicates the action performed.
The available format types for formatting of output.
Formats the output data as a list of strings. If an array of objects is present in the output, each is stringified and printed on a newline.
Formats the output data as a table using the properties as the column headers. You must ensure that the array of objects is homogeneous for the table to print properly.
Formats the output data as a string. If the output data is an object/array it is stringified.
Formats the output a prettified JSON object.
String credential
This type defines the signature for a function taht calls the credential manager. This is used by the TypeScript compiler to verify that any function that wants to call the credential manager have the necessary arguments sent to it.
The path to a child property
The value of said property
Set to true if failure to find credentials should be ignored
type that specifies the choice of token types
Callback that is invoked when a command defined to yargs completes execution.
list that specifies the choice of token types
Session type property value for basic authentication
Session type property value for bearer token authentication
Session type property value for certificate authentication, which uses a certificate file and key file.
Session type property value for no authentication
Session type property value for cookie token authentication, which uses a named token type.
https protocol
http protocol
tokenType property value for an API Mediation Layer token
tokenType property value for a JWT token
tokenType property value for IBM's LTPA2 token
The tests to check for problems that we run for environmental items. One ItemId can have multiple entries in the array, to check for different problems. When the probExpr is true, we have a problem, and we print the probMsg.
Change display mode of page
0 = Tree View, 1 = Flat View
Find the currently scrolled to command anchor in iframe
Element with tag
Common function that returns npm command as a string.
command with npm path
Get the preferred theme name for JSTree (light or dark).
Theme name
Fetch name and version of NPM package that was installed
The package name as specified on NPM install
Get the registry to install to.
Common function that abstracts the install process. This function should be called for each
package that needs to be installed. (ex: sample-cli plugin install a b c d
-> calls install 4
times)
A package name or location. This value can be a valid npm package
name or the location of an npm tar file or project folder. Also,
git URLs are also acceptable here (basically anything that npm install
supports). If this parameter is a relative path, it will
be converted to an absolute path prior to being passed to the
npm install
command.
The npm registry to use, this is expected to be passed by every caller so if calling functions don't have a registry available, they need to get it from npm.
The name of the plugin.
Common function that installs a npm package using the local npm cli.
Path where to install npm the npm package.
The npm registry to install from.
The name of package to install.
command response
Load command tree components
NPM login to be able to install from secure registry
The npm registry to install from.
Update selected node in command tree after new page loaded in iframe
Event object sent by postMessage
Search command tree after text in search box has changed
If true, searches instantly rather than delaying 250 ms
Generate list of context menu items for a node
Node that was right clicked
List of context menu items containing labels and actions
Update current node and search bar after command tree (re)loaded
Check if node is matched by a search string
NUL-delimited list of search strings
True if the node matches
Update current node after new node selected in tree
jsTree event data
Find all possible combinations of a search string that exist with different aliases
Search string input by user
NUL-delimited list of search strings with all combinations of aliases
Run another instance of the host CLI command to validate a plugin that has just been installed. We use a separate process instead of an API call because when the user re-installs an existing plugin we cannot validate if the plugin has conflicting command names because the plugin has already been incorporated into the Imperative command tree, and thus it could conflict with its own commands. However, if we run a validate command in a new process, we start with a clean slate and we get accurate results.
The name of a plugin to be validated.
Show tooltip next to copy button that times out after 1 sec
Button element the tooltip will show next to
Message to show in the tooltip
Toggle visibility of command tree
Split.js object
A package name. This value is a valid npm package name.
A package name. This value is a valid npm package name.
The npm registry.
Updates extenders.json
and returns a list of types to remove from the schema, if applicable.
The package name for the plug-in that's being uninstalled
A list of types to remove from the schema
Update node that docs are displayed for
Node ID to select
Whether to load docs page for node
Whether to expand tree node
Whether to update node even if already selected
Definition for the 'config report-env' command.
Definition of the convert-profiles command.
Definition of the edit command.
Definition of the firststeps command.
Definition of the import command.
Definition of the init command.
Definition of the install command.
Definition of the paths command.
Definition of the paths command.
Definition of the uninstall command.
Definition of the update command.
Definition of the validate command.
Generated using TypeDoc
Imperative CLI Framework
Imperative CLI Framework is a command processing system that lets you quickly build customized command-line interfaces. Focus on adding functionality for your users rather than creating CLI infrastructure. We provide you with all the tools to get started building your own CLI plug-ins.
Software Requirements
Install Node.js package manager on your computer. Node.jsĀ® is a JavaScript runtime environment on which we architected Imperative CLI Framework.
You must have a means to execute ".sh" (bash) scripts to run integration tests. On Windows, you can install "Git Bash", which is bundled with the standard Git installation - (choose the "Use Git and Unix Tools from Windows Command Prompt" installation option). When you run the integration tests on Windows, you must have Administrative authority to enable the integration tests to create symbolic links.
Note: Broadcom Inc. does not maintain the prerequisite software that Imperative CLI Framework requires. You are responsible for updating Node.js and other prerequisites on your computer. We recommend that you update Node.js regularly to the latest Long Term Support (LTS) version.
Install Imperative as a Dependency
Issue the following commands to install Imperative CLI Framework as a dependency.
Install
@latest
version:Be aware that if you update via
@latest
, you accept breaking changes into your project.Install
@zowe-v2-lts
version:This is a Long Term Support release that is guaranteed to have no breaking changes.
Note: If you want to install the bleeding edge version of Imperative, you can append
--@zowe:registry=https://zowe.jfrog.io/zowe/api/npm/npm-release/
to the install command to get it from a staging registry. It is not recommended to use this registry for production dependencies.Build and Install Imperative CLI Framework from Source
To build and install the Imperative CLI Framework, follow these steps:
zowe/imperative
project to your PC.cd [relative path]/imperative
npm install
npm run build
npm run test
To build the entire project (including test stand-alone CLIs):
npm run build
To build only imperative source:
npm run build:packages
Run Tests
npm run test
npm test:unit
npm test:integration
npm test:system
Note: To build and install the test CLIs used by the integration tests:
node scripts/sampleCliTool.js build
node scripts/sampleCliTool.js install
Sample Applications
We provide a sample plug-in that you can use to get started developing your own plug-ins. See the Zowe CLI Sample Plug-in.
Documentation
We provide documentation that describes how to define commands, work with user profiles, and more! For more information, see the Imperative CLI Framework wiki.
Contribute
For information about how you can contribute code to Imperative CLI Framework, see CONTRIBUTING.
Submit an Issue
To report a bug or request an enhancement, please submit an issue.
Versioning
Imperative CLI Framework uses Semantic Versioning (SemVer) for versioning. For more information, see the Semantic Versioning website.
Licensing Imperative CLI Framework
For Imperative CLI Framework licensing rules, requirements, and guidelines, see LICENSE.