Concept of thi-scripts

Files and directories

A thi-script is basically a help-file. thi-scripts are organised hierarchically in directory/subdirectories.  $THIPATH is the base directory. Both, directory and files are thi-scripts and can be accessed in the same way.

Invoking a thi-script file, displays the file.
Invoking a thi-directory will display the directory's content.

thi-scripts base directory

example 1: thi-script base directory

By simply typing the corresponding number and [enter] directly on the console, the chosen thi-script is displayed: Choosing a directory will move to the chosen directory and show the entries.

'examples' directory

example 2: Choosing an entry from the list

Display a thi-script

To display a thi-script, simply type the corresponding number and [enter].

'dummy' file with examples

example 3: Displaying a thi-script

The above example shows thi-script "dummy.thi". The numbers displayed refer to thi-commands.  By typing the corresponding number and [enter] the commands are executed. thi-commands can spawn over one line or many lines and can contain one or many shell commands.

thi-commands

Thi-commands are one or more shell commands grouped together and offered for execution. They are numbered and marked red.
Every thi-command in the thi-script can directly be executed by typing the corresponding number in the console and [enter].
There are three types of thi-commands:

  1. regular commands
    list of commands with an optional comment
  2. file commands
    a link to a script. The script name (filename) or the script's content is displayed.
  3. alias commands
    The text shown is just text. The real command is hidden in a file. Alias commands are marked with a '!'.

Regular thi-commands are one or many shell commands grouped together an offered for execution. Typing the corresponding number and [enter] on the console will execute the command within the thi-command.

File command (or @cmf-statements) are links to scripts: The command just contains the scriptname to execute. 'x' toggles between showing the script's content or showing the script's name.

Alias commands are like file comands. The real command lies in a script, like in file commands, but toggling is not possible. The text shown is just text that will not be executed. Alias commands are mainly used when special characters mess up the display (or when you want to hide a long and ugly shell script ;-) ...).

command one executed

example 4: Executing a command

You don't have to use command number 1 before using command number 2. Each command listed is independent and can be executed by itself.

The command is executed 'as is'. There is no checking if a previous command has been executed (that is essential), nor is there checking if a command was executed successfully.

Thi-commands can contain a single command or stretch over multiple lines.

Variables

Thi-command number 3 contains a variable. Above the variable value is shown. To toggle between showing the variable name and the varible value, use:

q [enter]

The command looks like this.

command 3 with variable shown instead of value

example 5: a command with a variable

Highlighting variables

To turn highlighting of a-variables on/off, use:

h [enter]

Changing an variable

To change an variable, use:

d [enter].

The variable dialog lists all a-variables used in the current thi-script. After choosing an variable, a list with predefined options for this variable is shown, if there are any. Variable '$MYVAR' is set to the default.

changing the value of a variable

example 6: changing the value of a variable.

To pick an entry from the list, just type the corresponding number and [enter]. To enter a new value, type the new value and press [enter]. To edit the list, just press [enter].

After setting a variable, the value will be stored for the future.

Double curly braces

Asking for parameters

The statement

{{@?:<prompt text>}}

prompts for user input just before the commands in a thi-command are executed. The ask-statement prompts for user input with the 'prompt text' and then replaces itself (the entire {{@?:..}}) with the user input.

the ask statement

example 6: The ask statement

In the above example, the ask-statement prompts with the parameter "what's the weather, dude?" and then replaces itself with the answer.

Showing external files

Textfiles can be included into thi-scripts as textfiles.

{{@file:<path/to/file>}}

To toggle between showing the file's name and the file's content, use:

z [enter]

This also toggles between @command-statements