TCLI: Providing Answers Inline
In this section we will give you answers to all your questions :-), no all jokes aside the TCLI is a very interactive tool in the way that it asks the user a question and then continues the work. This is not always desired, especially not in a build pipeline, since it will never finish.
Run TCLI interactively
Let's say we run for example (in a folder with a tibco-cloud property file):
The first thing that will happen is that you will get a question:
What would you like to validate ?
Let's say if we answer Property_exist, we will get the question:
Which property would you like to validate (Use plus character to validate multiple properties, for example: prop1+prop2) ?
If we answer CloudLogin.Region, we will get the following result:
Note: There are a bunch of things you can validate:
Note: for more information on Validation, see the validation task
Run TCLI with the -a command
Let's say we want to do this validation without any interaction we can run this command:
tcli <TASK> --answers(a) <answers>
Note: The answers flag is only allowed when a task is provided, so the initial setup (creating the tibco-cloud property file) is always manual. But remember there are tasks to manage the global config and the creation of a multiple property file.
This means the tcli completely runs verbose, meaning it won't stop execution to ask the user for input. The answers are comma(,) separated or semicolon(:) separated. So for example:
tcli validate -a Property_exist:CloudLogin.Region
Or another example:
tcli validate -a Property_exist:CloudLogin.Region+AnotherProperty
Note: You want to escape backslashes in property files (by using double '\' And you can escape a semi-colon in the answer itself by escaping it with [[:]]. This is useful when passing in Windows folder structures for example:
tcli add-or-update-property -a "file.properties:Folder_To_Use:none:C[[:]]\\My_Folder\\
Also note that the Recorder will automatically create these Semicolon escapes for you, for example:
[RECORDER] ● Replay command: tcli add-or-update-property -a "default:MyFolder:Folder to use:C[[:]]\Folder\"
Updating properties with answers
You can provide answers to Any task in tcli! Let's take another example where we update a property:
This task would normally ask these questions:
In which file would you like to update a property ? (use enter or default for the current property file) Which property would you like to update or add ? What comment would you like to add ? What value would you like to add ? (use SPECIAL to select from a list) --> If SPECIAL is used: What type of answer would you like to add to the property ?
We could for example answer:
tcli add-or-update-property -a DEFAULT:SaveMe:'I want to be saved':'I am safe...'
Note: Use quotes when there are spaces in the value.
This runs like this:
And results in this being added to the tibco-cloud properties file:
Too little answers is wrong but too many is ok
Note: It is important to know that when you provide too many answers nothing will go wrong. But when you provide to too little an error is given (and the tcli does not revert to manual input).
tcli add-or-update-property -a DEFAULT:SaveMe:none:'I am safe again...':'what am I doing here...'
Is perfectly ok, but:
tcli add-or-update-property -a DEFAULT:SaveMe:none:SPECIAL
Will result in the following error:
Note: These are the special values that can be added:
Note: for more information adding properties, see the add-or-update-property task
And should be, for example:
tcli add-or-update-property -a DEFAULT,SaveMe,none,SPECIAL,SandboxID
Note: You can use comma(,) separated values or semi colon separated values. It does not really matter, only in the multiple cloud property files you need to use semi colon separated values (otherwise the task interpretation gets confused).