new

You can use the new command to create a new context in the config.yaml file.

Syntax and command line options

You can enter the command as follows:
ocli context new context_name
The context_name parameter is mandatory. Once you provide the context name a message is displayed to enter URL. You must provide the host and port name separated by a colon (:). These are mandatory values that you must provide to create a context. For more details see the following example.
Example:
  1. Follow the below steps to create a context named TEST with localhost and 8080 as host and port respectively.
    1. Enter the command
      ocli context new TEST
      The following message is displayed to add host and port name
      ocli context new TEST
      Enter url:
      Note: If you do not provide the environment name the following message is displayed:
      ocli context new
      Enter context name:

      You must enter a valid name to continue.

    2. Enter the host and port name separated by a colon (:)
      ocli context new TEST
      Enter url:
      localhost:8080
      A confirmation message is displayed to indicate the creation of the new context.
      ocli context new TEST
      Enter url:
      localhost:8080
      You have successfully added the TEST context.
      Note: If you enter http or https as port, the default values 80 and 443 are respectively added to the config.yaml file.
  2. Follow the below steps to create the LOCAL context with localhost and 9433 as host and port respectively.
    1. Enter the command
      ocli context new LOCAL
      The following message is displayed to add host and port name
      ocli context new LOCAL
      Enter url:
    2. Enter the url as https://localhost:9433/:
      ocli context new TEST
      Enter url:
      https://localhost:9433/
      A confirmation message is displayed to indicate the creation of the new context.
      ocli context new TEST
      Enter url:https://localhost:9433/
      You have successfully added the LOCAL context.
      Note: If you enter http or https as URL and did not add any specific value as port, the default values 80 and 443 are respectively added to the config.yaml file.