Type aliases
CLIENT_PROPERTY
CLIENT_PROPERTY: "requestSuccess" | "requestFailure" | "data" | "dataString" | "response" | "session" | "log"
COMMAND_RESPONSE_FORMAT
COMMAND_RESPONSE_FORMAT: "json" | "default"
CommandOptionType
CommandOptionType: "array" | "boolean" | "count" | "existingLocalFile" | "json" | "number" | "string" | "stringOrEmpty"
CommandSegment
CommandSegment: "group" | "command"
ContentEncoding
ContentEncoding: typeof CONTENT_ENCODING_TYPES[number]
HTTP_VERB
HTTP_VERB: "GET" | "PUT" | "POST" | "DELETE"
ICommandHandlerConstructor
ICommandHandlerConstructor: {}
ICommandNodeType
ICommandNodeType: "group" | "command"
IConstructor
IConstructor<T>: {}
Type parameters
ICredentialManagerConstructor
ICredentialManagerConstructor: {}
IImperativeOverrides
IImperativeOverrides: ConstructorOrString<ImperativeOverrides>
IOperationCompleted
IOperationCompleted<T>: (output: T) => void
Type parameters
IOperationResultReady
IOperation
ResultReady<T>: (output: T, operationResults: IOperationResult<any>) => void
Type parameters
IOperationUndoCompleted
IOperationUndoCompleted: () => void
IProfileValidationTaskFunction
ImperativeYargsCommandAction
ImperativeYargsCommandAction: "syntax validation" | "command handler invoked" | "help invoked"
OUTPUT_FORMAT
OUTPUT_FORMAT: "list" | "table" | "string" | "object"
RestClientResolve
RestClientResolve: (data: string) => void
RestErrorSource
RestErrorSource: "client" | "http"
SecureCredential
SecureCredential: string
SecureOperationFunction
Secure
OperationFunction: (propNamePath: string, propValue?: any, optional?: boolean) => Promise<any>
Type declaration
-
- (propNamePath: string, propValue?: any, optional?: boolean): Promise<any>
-
Parameters
-
propNamePath: string
-
Optional propValue: any
-
Optional optional: boolean
- The processed value after the secure operation function runs
VALIDATION_OUTCOME
VALIDATION_OUTCOME: "Failed" | "OK" | "Warning"
YargsCommandCompleted
Yargs
CommandCompleted: (args: Arguments, response: IYargsResponse) => void
Object literals
Const MOCKED_COMMAND_TREE
MOCKED_COMMAND_TREE: object
children
children: { description: string; name: string; options: ({ description: string; name: string; type: "string" } | { description: string; name: string; type: "boolean" })[]; positionals: { description: string; name: string; required: false; type: "string" }[]; type: "command" }[] = [{name: "test-command-one",description: "test command one",type: "command",options: [{name: "test-option",description: "the option",type: "string"},{name: "test-boolean",description: "the boolean option",type: "boolean"}],positionals: [{name: "positional1",description: "the positional option",type: "string",required: false}]},{name: "test-command-two",description: "test command two",type: "command",options: [{name: "test-option",description: "the option",type: "string"},{name: "test-boolean",description: "the boolean option",type: "boolean"}],positionals: [{name: "positional1",description: "the positional option",type: "string",required: false}]}]
description
description: string = "a test group"
name
name: string = "test-group"
type
type: "group" = "group"
Const apiErrorHeader
apiErrorHeader: object
message
message: string = `${Constants.FRAMEWORK_DISPLAY_NAME} API Error`
Const authCategoryDesc
authCategoryDesc: object
message
message: string = `Connect to token-based authentication services`
Const authLoginCommandDesc
authLoginCommandDesc: object
message
message: string = `Log in to {{type}} authentication service`
Const authLoginGroupDesc
authLoginGroupDesc: object
message
message: string = `${authLoginGroupSummary.message}.`
Const authLoginGroupSummary
authLoginGroupSummary: object
message
message: string = `Log in to an authentication service`
Const authLoginShowTokenDesc
authLoginShowTokenDesc: object
message
message: string = `Show the token when login is successful. If specified, does not save the token to a profile.`
Const authLogoutCommandDesc
authLogoutCommandDesc: object
message
message: string = `Log out of {{type}} authentication service`
Const authLogoutGroupDesc
authLogoutGroupDesc: object
message
message: string = `${authLogoutGroupSummary.message}.`
Const authLogoutGroupSummary
authLogoutGroupSummary: object
message
message: string = `Log out of an authentication service`
Const couldNotInstantiateCommandHandler
couldNotInstantiateCommandHandler: object
message
message: string = `Could not instantiate the handler {{commandHandler}} for ` +`command {{definitionName}}`
Const createProfileCommandDesc
createProfileCommandDesc: object
message
message: string = `Create a {{type}} profile`
Const createProfileDisableDefaultsDesc
createProfileDisableDefaultsDesc: object
message
message: string = `Disable populating profile values of undefined properties with default values.`
Const createProfileOptionDesc
createProfileOptionDesc: object
message
message: string = `Specifies the name of the new {{type}} profile. ` +`You can load this profile by using the name on commands that support the ` +`"--{{type}}-profile" option.`
Const createProfileOptionOverwriteDesc
createProfileOptionOverwriteDesc: object
message
message: string = `Overwrite the {{type}} profile when a profile of the same name exists.`
Const createProfilesCommandDesc
createProfilesCommandDesc: object
message
message: string = `${createProfilesCommandSummary.message}.`
Const createProfilesCommandSummary
createProfilesCommandSummary: object
message
message: string = `Create new configuration profiles`
Const deleteProfileActionDesc
deleteProfileActionDesc: object
message
message: string = `Delete a {{type}} profile.`
Const deleteProfileCommandDesc
deleteProfileCommandDesc: object
message
message: string = `Delete a {{type}} profile.` +` You must specify a profile name to be deleted. To find a list of available profiles for deletion, ` +` issue the profiles list command. By default, you will be prompted to confirm the profile removal.`
Const deleteProfileDepsDesc
deleteProfileDepsDesc: object
message
message: string = `Set to true to delete all dependent profiles along with the {{type}} profile.` +`If set to true, a list of dependent profiles will be shown along with a confirmation prompt before the ` +`deletions occur. If set to false, only the {{type}} profile specified will be deleted.`
Const deleteProfileExample
deleteProfileExample: object
message
message: string = `Delete a {{type}} profile named {{name}}`
Const deleteProfileForceOptionDesc
deleteProfileForceOptionDesc: object
message
message: string = `Force deletion of profile, and dependent profiles if specified. No prompt will be displayed before `+ ` deletion occurs.`
Const deleteProfileNameDesc
deleteProfileNameDesc: object
message
message: string = `Specifies the name of the {{type}} ` +` profile to be deleted. ` +`You can also load this profile by using the name on commands that support the ` +`"--{{typeOption}}" option.`
Const deleteProfilesCommandDesc
deleteProfilesCommandDesc: object
message
message: string = `${deleteProfilesCommandSummary.message}.`
Const deleteProfilesCommandSummary
deleteProfilesCommandSummary: object
message
message: string = `Delete existing profiles`
Const detailProfileCommandDesc
detailProfileCommandDesc: object
message
message: string = `Show details of a profile of a selected type.`
Const errorDetailsHeader
errorDetailsHeader: object
message
message: string = "Error Details:"
Const getDefinition
getDefinition: object
aliases
aliases: string[] = ["ge"]
description
description: string = "Get a value of single setting option."
examples
examples: { description: string; options: string }[] = [{options: "CredentialManager",description: "Get a value of CredentialManager setting"}]
handler
handler: string = join(__dirname, "get.handler")
name
name: string = "get"
positionals
positionals: { description: string; name: string; required: true; type: "string" }[] = [{name: "configName",type: "string",description: "Setting name",required: true}]
summary
summary: string = "Get a value of single setting option"
type
type: "command" = "command"
Const installDefinition
installDefinition: object
description
description: string = "Install plug-ins to an application."
examples
examples: { description: string; options: string }[] = [{description: `Install plug-ins saved in ${PMFConstants.instance.PLUGIN_JSON}`,options: ""},{description: "Install plug-ins saved in a properly formatted config file",options: "--file /some/file/path/file_name.json"},{description: "Install a remote plug-in",options: "my-plugin"},{description: "Install a remote plug-in using semver",options: "my-plugin@\"^1.2.3\""},{description: "Install a remote plug-in from the specified registry",options: "my-plugin --registry https://registry.npmjs.org/"},{description: "Install a local folder, local TAR file, and a git URL",options: "./local-file /root/tar/some-tar.tgz git://github.com/project/repository.git#v1.0.0"},{description: "Install a remote plug-in from the registry which requires authorization" +"(don't need to use this flag if you have already logged in before)",options: "my-plugin --registry https://registry.npmjs.org/ --login"}]
handler
handler: string = join(__dirname, "install.handler")
name
name: string = "install"
options
options: ({ conflictsWith: string[]; description: string; name: string; required: false; type: "existingLocalFile" } | { description: string; name: string; required: false; type: "string" } | { description: string; implies: string[]; name: string; required: false; type: "boolean" })[] = [{name: "file",type: "existingLocalFile",description: fileDescription,required: false,conflictsWith: ["registry"]},{name: "registry",type: "string",description: registryDescription,required: false},{name: "login",type: "boolean",description: loginDescription,required: false,implies: ["registry"]}]
positionals
positionals: { description: string; name: string; required: false; type: "string" }[] = [{name: "plugin...",type: "string",description: pluginDescription,required: false}]
summary
summary: string = "Install a plug-in"
type
type: "command" = "command"
Const listDefinition
listDefinition: object
aliases
aliases: string[] = ["li"]
description
description: string = "List all configuration setting options."
examples
examples: { description: string; options: string }[] = [{options: "",description: "List all configuration setting options"},{options: "--values",description: "List all configuration setting options with values"}]
handler
handler: string = join(__dirname, "list.handler")
name
name: string = "list"
options
options: { description: string; name: string; type: "boolean" }[] = [{name: "values",type: "boolean",description: "Show values for every option",},]
summary
summary: string = "List all configuration setting options"
type
type: "command" = "command"
Const listGroupWithOnlyProfileCommandSummary
listGroupWithOnlyProfileCommandSummary: object
message
message: string = `List {{type}} loaded profiles`
Const listGroupWithOnlyProfileDefaultDesc
listGroupWithOnlyProfileDefaultDesc: object
message
message: string = `Lists all known profiles for this command group. ` +`When you issue a command that requires a profile or set of ` +`profiles, said profiles are loaded by default (or according to override options on the command). You can use this ` +`command to review your configured profiles, and verify your default profile set.`
Const listGroupWithOnlyProfileSetDesc
listGroupWithOnlyProfileSetDesc: object
message
message: string = `To set the default profiles, use the \" ` +`{{type}} ${Constants.DEFAULT_SET_GROUP} ${Constants.DEFAULT_SET_PROFILE_OBJECT}\" command.`
Const listGroupWithOnlyProfilesDefinition
listGroupWithOnlyProfilesDefinition: object
message
message: string = `List the {{type}} profiles loaded.`
Const listGroupWithOnlyProfilesSummary
listGroupWithOnlyProfilesSummary: object
message
message: string = `List the {{type}} profiles loaded`
Const listProfileCommandDesc
listProfileCommandDesc: object
message
message: string = `List profiles of the type {{type}}`
Const listProfileCommandSummary
listProfileCommandSummary: object
message
message: string = `List existing profiles`
Const listProfileExample
listProfileExample: object
message
message: string = `List profiles of type {{type}}`
Const listProfileExampleShowContents
listProfileExampleShowContents: object
message
message: string = `List profiles of type {{type}} and display their contents`
Const listProfileLoadedModulesOptionDesc
listProfileLoadedModulesOptionDesc: object
message
message: string = `List {{type}} ` +` profiles that are loaded as part of normal command execution. ` +`This will show you the default profiles being loaded.`
Const listProfileVerboseOptionDesc
listProfileVerboseOptionDesc: object
message
message: string = `List {{type}} ` +` profiles and their contents. ` +`All profile details will be printed as part of command output.`
Const listProfilesFoundMessage
listProfilesFoundMessage: object
message
message: string = `The following profiles were found of the type "{{type}}":`
Const listProfilesNotFoundMessage
listProfilesNotFoundMessage: object
message
message: string = `No profiles were found of the type "{{type}}".`
Const locateProfilesDesc
locateProfilesDesc: object
message
message: string = `Configuration profiles are located and used by searching in the following order,` +` ending the search when a profile is found:`
Const overroteProfileMessage
overroteProfileMessage: object
message
message: string = "Overwrote existing profile for {{profileOption}}."
Const profileCreateErrorDetails
profileCreateErrorDetails: object
message
message: string = "Error Details: {{errorDetails}}"
Const profileCreateErrorHeader
profileCreateErrorHeader: object
message
message: string = "Profile Create Error"
Const profileCreatedSuccessfully
profileCreatedSuccessfully: object
message
message: string = `Profile created successfully.`
Const profileCreatedSuccessfullyAndPath
profileCreatedSuccessfullyAndPath: object
message
message: string = `Profile created successfully! Path:`
Const profileDeleteErrorDetails
profileDeleteErrorDetails: object
message
message: string = "Error Details: {{errorDetails}}"
Const profileDeleteErrorHeader
profileDeleteErrorHeader: object
message
message: string = "Profile Deletion Error"
Const profileDeletedSuccessfully
profileDeletedSuccessfully: object
message
message: string = "Successfully deleted the following profile(s): "
Const profileDesc
profileDesc: object
message
message: string = `Configuration profiles are loaded based on the requirements ` +`of the command:`
Const profileLoadError
profileLoadError: object
message
message: string = `Error loading {{type}} profile: {{profileName}}.\n\n` +`Additional Details:\n\n`
Const profileNotDeletedMessage
profileNotDeletedMessage: object
message
message: string = "No profiles were deleted."
Const profileReviewMessage
profileReviewMessage: object
message
message: string = "Review the created profile and edit if necessary using the profile update command."
Const profileUpdatedSuccessfullyAndPath
profileUpdatedSuccessfullyAndPath: object
message
message: string = `Profile updated successfully! Path:`
Const resetDefinition
resetDefinition: object
aliases
aliases: string[] = ["re"]
description
description: string = "Reset a configuration setting to default value."
examples
examples: { description: string; options: string }[] = [{options: "CredentialManager",description: "Reset the credential manager to default value"}]
handler
handler: string = join(__dirname, "reset.handler")
name
name: string = "reset"
positionals
positionals: { description: string; name: string; required: true; type: "string" }[] = [{name: "configName",type: "string",description: "Setting name to reset",required: true},]
summary
summary: string = "Reset a configuration setting to default value"
type
type: "command" = "command"
Const selectProfileNameDesc
selectProfileNameDesc: object
message
message: string = `Specifies the name of the {{type}} ` +`profile to be used with this command. ` +`To see profiles that can be validated, issue the list action for this module. ` +`You can also load this profile by using the name on commands that support the ` +`"--{{typeOption}}" option.`
Const setDefinition
setDefinition: object
aliases
aliases: string[] = ["se"]
description
description: string = "Set a configuration setting."
examples
examples: { description: string; options: string }[] = [{options: "CredentialManager my-credential-manager",description: "Set the default credential manager to my-credential-manager"}]
handler
handler: string = join(__dirname, "set.handler")
name
name: string = "set"
positionals
positionals: { description: string; name: string; required: true; type: "string" }[] = [{name: "configName",type: "string",description: "Setting name. Possible values:\n" +"CredentialManager - The package name of a plugin that will override the default " +"credential manager to allow for different credential storage methods.",required: true},{name: "configValue",type: "string",description: "Value to set",required: true},]
summary
summary: string = "Set a configuration setting"
type
type: "command" = "command"
Const setGroupWithOnlyProfilesCommandDesc
setGroupWithOnlyProfilesCommandDesc: object
message
message: string = `The {{type}} set ${Constants.DEFAULT_SET_PROFILE_OBJECT} command allows you to set the default profiles for ` +`this command group. When a {{type}} command is issued and no profile override options are ` +`specified, the default profiles for the command group are automatically loaded for the command based on the ` +`commands profile requirements.`
Const setGroupWithOnlyProfilesListDesc
setGroupWithOnlyProfilesListDesc: object
message
message: string = `To view the default profiles, use the \" ` +`{{type}} ${Constants.DEFAULT_LIST_GROUP} ${Constants.DEFAULT_LIST_PROFILE_OBJECT}\" command.`
Const setGroupWithOnlyProfilesSummary
setGroupWithOnlyProfilesSummary: object
message
message: string = `Set the defaultprofiles for the {{type}} group`
Const setProfileActionDesc
setProfileActionDesc: object
message
message: string = `${setProfileActionSummary.message}.`
Const setProfileActionSummary
setProfileActionSummary: object
message
message: string = `Set which profiles are loaded by default`
Const setProfileExample
setProfileExample: object
message
message: string = `Set the default profile for type {{type}} to the profile named '{{name}}'`
Const setProfileOptionDesc
setProfileOptionDesc: object
message
message: string = `Specify aprofile for default usage within the {{type}} group. ` +`When you issue commands within the {{type}} group without a profile specified as part of the command, the default ` +`will be loaded instead.`
Const showDependenciesCommandDesc
showDependenciesCommandDesc: object
message
message: string = `View all profiles which may be used within a selected group.`
Const syntaxErrorHeader
syntaxErrorHeader: object
message
message: string = `\nSyntax Error`
Const unableToCreateProfile
unableToCreateProfile: object
message
message: string = "Unable to create the requested profile."
Const unableToDeleteProfile
unableToDeleteProfile: object
message
message: string = "Not all requested profiles could be deleted."
Const unableToFindProfile
unableToFindProfile: object
message
message: string = "Could not find or load the supplied profile name. Error details: "
Const unableToLoadRequestedProfilesError
unableToLoadRequestedProfilesError: object
message
message: string = "Command processing cannot continue: Unable to load requested or default profiles."
Const unexpectedCommandError
unexpectedCommandError: object
message
message: string = "Unexpected Command Error"
Const unexpectedCommandPreparationError
unexpectedCommandPreparationError: object
message
message: string = "An unexpected command preparation error occurred:"
Const unexpectedProfileCreationError
unexpectedProfileCreationError: object
message
message: string = `An unexpected profile creation error occurred: \n{{unexpectedError}}`
Const unexpectedProfileLoadError
unexpectedProfileLoadError: object
message
message: string = "An unexpected profile load error occurred:"
Const unexpectedProfileUpdateError
unexpectedProfileUpdateError: object
message
message: string = `An unexpected profile update error occurred: \n{{unexpectedError}}`
Const unexpectedProfilesLoadError
unexpectedProfilesLoadError: object
message
message: string = "An unexpected error occurred while loading requested profiles:"
Const uninstallDefinition
uninstallDefinition: object
description
description: string = "Uninstall plug-ins."
examples
examples: { description: string; options: string }[] = [{description: "Uninstall a plug-in",options : "my-plugin"},]
handler
handler: string = join(__dirname, "uninstall.handler")
name
name: string = "uninstall"
positionals
positionals: { description: string; name: string; required: false; type: "string" }[] = [{name: "plugin...",type: "string",description: pluginDescription,required: false}]
summary
summary: string = "Uninstall a plug-in"
type
type: "command" = "command"
Const updateDefinition
updateDefinition: object
description
description: string = "Update plug-ins."
examples
examples: { description: string; options: string }[] = [{description: "Update a plug-in",options : "my-plugin"},{description: "Update a remote plug-in from the registry which requires authorization" +"(don't need to use this flag if you have already logged in before)",options: "my-plugin --registry https://registry.npmjs.org/ --login"}]
handler
handler: string = join(__dirname, "update.handler")
name
name: string = "update"
options
options: ({ description: string; name: string; required: false; type: "string" } | { description: string; implies: string[]; name: string; required: false; type: "boolean" })[] = [{name: "registry",type: "string",description: registryDescription,required: false},{name: "login",type: "boolean",description: loginDescription,required: false,implies: ["registry"]}]
positionals
positionals: { description: string; name: string; required: false; type: "string" }[] = [{name: "plugin...",type: "string",description: pluginDescription,required: false}]
summary
summary: string = "Update a plug-in"
type
type: "command" = "command"
Const updateProfileActionDesc
updateProfileActionDesc: object
message
message: string = `Update a {{type}} profile`
Const updateProfileCommandDesc
updateProfileCommandDesc: object
message
message: string = `Update a {{type}} profile. ` +`You can update any property present within the profile configuration. The updated profile ` +`will be printed so that you can review the result of the updates.`
Const updateProfileCommandSummary
updateProfileCommandSummary: object
message
message: string = `Update existing profiles`
Const validateDefinition
validateDefinition: object
description
description: string = "Validate a plug-in that has been installed."
examples
examples: { description: string; options: string }[] = [{description: `Validate a plug-in named my-plugin`,options : "my-plugin"},{description: "Validate all installed plug-ins",options : ""},]
handler
handler: string = join(__dirname, "validate.handler")
name
name: string = "validate"
positionals
positionals: { description: string; name: string; required: false; type: "string" }[] = [{name: "plugin",type: "string",description: pluginDescription,required: false}]
summary
summary: string = "Validate a plug-in"
type
type: "command" = "command"
Const validateProfileCommandDesc
validateProfileCommandDesc: object
message
message: string = `Test the validity of a {{type}} profile.`
Const validateProfileCommandSummary
validateProfileCommandSummary: object
message
message: string = `Test the validity of a profile`
Const validateProfileGroupDesc
validateProfileGroupDesc: object
message
message: string = `Test the validity of your profiles.`
Const validateProfileNameDesc
validateProfileNameDesc: object
message
message: string = `Specifies the name of the {{type}} ` +` profile to be validated. ` +`If the --print-plan-only option is specified, then only a plan to validate the specified profile will be displayed.`
Const validateProfileOptionDesc
validateProfileOptionDesc: object
message
message: string = `Validate the state of a group.`
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.
To build this project from source, you must have Python 2.7 and a C++ Compiler installed (both are required by a dependency named
node-gyp
). To obtain the required software, follow the instructions in the node-gyp readme specific to your OS.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. Note that the registry URL differs between versions of Imperative CLI Framework.
Install
@latest
version:Be aware that if you update via
@latest
, you accept breaking changes into your project.Install
@lts-incremental
version:Build and Install Imperative CLI Framework from Source
To build and install the Imperative CLI Framework, follow these steps:
Note: You can skip to the next step if you installed node-gyp previously.
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:
gulp build
Run Tests
npm run test
npm test:integration
npm test:unit
Note: To run the integration tests via gulp, install all dependencies for test CLIs, build all test CLIs, & install all sample CLIs globally using the following sequence:
gulp build:install-all-cli-dependencies
gulp build:all-clis
gulp test:installSampleClis
Note: For more information about the tasks (details and descriptions), issue the following gulp command:
gulp --tasks
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
Versioning
Imperative CLI Framework uses Semantic Versioning (SemVer) for versioning. For more information, see the Semantic Versioning website.
Licencing Imperative CLI Framework
For Imperative CLI Framework licensing rules, requirements, and guidelines, see LICENSE.