Automatic completion of commands in a Bash shell

How to use the Bash auto-complete feature for ibmint and mqsi commands in a Bash shell.

What is the Bash auto-complete feature?

You can use the Bash auto-complete feature to help you build valid ibmint and mqsi commands in a Bash shell. This feature is available on Linux® and UNIX systems on which a Bash shell is available.

Bash auto-complete enables you to type commands more quickly and easily, by suggesting possible options when you press the Tab key after you type a partial command or parameter. This feature helps ensure that the command is valid, that the various parameters are input correctly, and offers valid suggestions when you need to cross-reference the output from other commands, such as with set credentials. It can also help to speed up the command line experience, by reducing the need to type out the full command names and parameter flags manually.
Tip: If you press the Tab key once, and there is only one possible match to complete the parameter or command, Bash auto-complete will provide this option. However, if there is more than one possible match, you must press the Tab key twice, and then a list of possible options will be displayed.

How to enable Bash auto-complete

The following shell scripts are provided in the IBM® App Connect Enterprise installation directory, under server/bash_autocompletion/:
  • ibmintcomplete.sh
  • mqsicomplete.sh
If you're using a Bash shell, the auto-complete feature is enabled automatically when you run the mqsiprofile command. For more information about the mqsiprofile command, see Setting up a command environment.

Examples

The following examples show how Bash auto-complete can help you to build valid commands.

Building valid ibmint commands
Valid ibmint commands are typically multiple words that are chained together, for example:
  • ibmint create broker
  • ibmint apply overrides
With Bash auto-complete, you can start typing an ibmint command, then press the Tab key, and the auto-complete feature will show you the valid option to complete the command. Or, if there are multiple options, press the Tab key twice, and a list of available options will be displayed.
Adding valid ibmint and mqsi command parameters
For example, the following mqsideploy command has few parameters to select, and they include single letter flags, such as -n for --integration-node-file.
BIP8841I: Deploys a BAR file or deletes resources from an integration server. 
Syntax:  
 mqsideploy integrationNodeSpec --integration-server <integrationServerName> ((--bar-file <BARFileName> [--clear]) | --resources-to-delete <resourcesToDelete>) [--timeout-seconds <timeoutSecs>] [ --detail-level detailLevel] [--trace <traceFileName>]  
  
 Command options:  
 'integrationNodeSpec' is one of:  
   (a) '[--integration-node] <integrationNodeName>' : Name of a locally defined integration node  
   (b) '--integration-node-file (-n) <integrationNodeFileName>' : File containing remote integration node connection parameters (*.broker)  
   (c) '[[--integration-node] <integrationNodeName>] --admin-host (-i) <host> --admin-port (-p) <port>' : hostname/ipAddress and port of a remote integration node. 'integrationNodeName' optional for validation.  
 '--integration-server (-e) <integrationServerName>' name of integration server  
 '--bar-file (-a) <BARFileName>' deploy the specified BAR file  
 '--clear (-m)' empties the integration server before deployment  
 '--resources-to-delete (-d) <resourcesToDelete>' deletes a colon-separated list of resources from the integration server  
 '--timeout-seconds (-w) <timeoutSecs>' : maximum number of seconds to wait for the integration node to respond (default is 60)  
 '--restart-all-applications' Stop and restart all applications during the deploy to allow in-use resources to be redeployed.  
 '--detail-level <detailLevel> control detail level of response messages.  
   0 = display summary information  
   1 = display summary and error information (default)  
   2 = display detailed information  
 '--trace (-v) <traceFileName>' : send verbose internal trace to the specified file.  
However, the ibmint commands don't include any single letter flags, and some commands have a lot more parameters, so using the auto-complete feature can help you to easily see and input the valid parameters, as shown in the following ibmint deploy example.
$ ibmint deploy --<tab><tab>
--cacert                     --https                      --integration-server-file    --output-integration-server  --project
--cacert-password            --input-bar-file             --java-version               --output-port                --restart-all-applications
--compile-maps-and-schemas   --input-path                 --no-https                   --output-uri                 --trace
--do-not-compile-java        --insecure                   --output-host                --output-work-directory      
--help                       --integration-node-file      --output-integration-node    --overrides-file  
ibmint command scenario help
Some commands require inputs based on your current deployment, or a build up of inputs to create complete commands. The Bash auto-complete feature can help with the ibmint command scenarios, by offering suggestions based on your input, as shown in the following examples.
ibmint delete|start|stop node - existing node names are suggested.
$ ibmint delete node <tab><tab>
NODE1         NODE2           sslNode3       TESTNODE      
ibmint delete|start|stop server - if the --integration-node parameter flag and value are stated in the command, then the existing server names are suggested.
$ ibmint start server --integration-node TESTNODE <tab><tab>
server1       server2
ibmint set admin-ssl|httpsconnector-ssl - valid actions are suggested.
$ ibmint set httpsconnector-ssl <tab><tab>
disabled  enabled   force  
ibmint set mode - available modes are suggested.
$ ibmint set mode <tab><tab>
Development          Non-Production       Production-Advanced  Production-Standard  
ibmint import credentials | export credentials --credential-type - available credential types are listed.
$ ibmint import credentials --credential-type <tab><tab>
Display all 152 possibilities? (y or n)
amazoncloudwatch     db2                  hubspotmarketing     mq                   sfcommerceclouddata
amazondynamodb       docusign             hunter               mqtt                 sftp
amazonec2            dropbox              ibmcoss3             msad                 shopify
amazoneventbridge    eis                  ibmewm               msdynamicscrmrest    slack
amazonkinesis        elk                  ibmopenpages         msdynamicsfando      smtp
amazonlambda         email                ibmsterlingiv        msexcel              snowflake
amazonrds            eventbrite           ibmsterlingsci       msexchange           soap
amazonredshift       expensify            ibmtwc               msonedrive           square
amazons3             factorialhr          ibmwatsonxai         msonenote            surveymonkey
amazonses            filenet              ift                  mspowerbi            toggltrack
amazonsns            front                ims                  mssharepoint         trello
amazonsqs            ftp                  infobip              mssql                truststore
anaplan              github               insightly            msteams              truststorekey
apptiotargetprocess  gitlab               jdbc                 mstodo               twilio
asana                gmail                jenkins              mysql                userdefined
azuread              googleanalytics      jira                 odbc                 watsondiscovery
azureblobstorage     googlebigquery       jms                  odm                  wordpress
bamboohr             googlecalendar       jndi                 opentelemetry        wrike
box                  googlechat           kafka                oracle               wsrr
businessmap          googlecloudstorage   kerberos             oracleebs            wufoo
calendly             googlecontacts       keystore             oraclehcm            wxs
cd                   googledrive          keystorekey          postgres             yammer
cdc                  googlegroups         kronos               rest                 yapily
cics                 googlepubsub         ldap                 salesforce           zendeskservice
clicksend            googlesheet          local                salesforceae         zohobooks
cloudantdb           googletasks          loopback             salesforcemc         zohocrm
cmis                 googletranslate      magento              sapariba             zohoinventory
confluence           greenhouse           mailchimp            sapodata             zohorecruit
couchbase            http                 marketo              sapsuccessfactors    
coupa                httpproxy            maximo               schemaregistry       
crystalball          hubspotcrm           mondaydotcom         servicenow 
ibmint specify jre --version - valid version numbers are suggested.
$ ibmint specify jre --version <tab><tab>
17  8   
ibmint package --java-version and ibmint deploy --java-version - valid version numbers are suggested.
$ ibmint package --java-version <tab><tab>
17  8   
ibmint set credential --credential-type - lists available credential types, and if you then select the credential type that you want, the auto-complete feature provides a list of extra credential flags that apply to that type. In the following example, --username and --password are added to the list of flags as the credential type selected is kafka.
$ ibmint set credential --credential-type kafka  --<tab><tab>
--admin-host                    --external-directory-vault      --integration-node              --username
--admin-port                    --external-directory-vault-key  --integration-server            --vault-key
--credential-name               --help                          --password                      --vaultrc-location
--credential-type               --integration-connection-file   --trace                         --work-directory
You can use auto-complete to help you build a complete credentials configuration command. For example, you can start with the following basic command.
$ ibmint set credential --<tab><tab>
--credential-type  --help   
Auto-complete shows that you need to select a credential type, and can then help you with selecting a valid type. In the following example, an m is input immediately before pressing the Tab key to show that you want to use a credential that begins with m.
$ ibmint set credential --credential-type m<tab><tab>
magento            maximo             mqtt               msdynamicsfando    msonedrive         mssharepoint       mstodo
mailchimp          mondaydotcom       msad               msexcel            msonenote          mssql              mysql
marketo            mq                 msdynamicscrmrest  msexchange         mspowerbi          msteams   
A credential type of mq is selected from the list, so auto-complete knows that auth-type is a valid flag for this credential type.
$ ibmint set credential --credential-type mq --<tab><tab>
--auth-type  --help
Finally, auto-complete provides the list of parameters that are available for your selected credential and authorization type.
$ ibmint set credential --credential-type mq --auth-type basicMTLSMQ --<tab><tab>
--admin-host                    --external-directory-vault-key  --password                      --username
--admin-port                    --help                          --private-key                   --vault-key
--auth-type                     --integration-connection-file   --private-key-id                --vaultrc-location
--credential-name               --integration-node              --public-key                    --work-directory
--credential-type               --integration-server            --ssl-peer-name                 
--external-directory-vault      --passphrase                    --trace   
In this way, you can see how Bash auto-complete can help you to build complex ibmint commands quickly and easily.