| |
---|
| | |
---|
| | By using \*(TC, you unburden your program from the major responsibility |
---|
| | of configuration file parsing and validation, while providing your |
---|
| | users a rich set of configuration features. |
---|
| | |
---|
| | If you run \*(TC directly, it will dump version and copyright |
---|
| | information, as well as the value of the current predefined |
---|
| | System Variables: |
---|
| | |
---|
| | .nf |
---|
| | python tconfpy.py |
---|
| | .fi |
---|
| | |
---|
| | |
---|
| | .SH DOCUMENT ORGANIZATION |
---|
| | |
---|
| | This document is divided into 4 major sections: |
---|
| |
---|
| | .endif |
---|
| | .fi |
---|
| | |
---|
| | .SS Comparison Conditional Directives |
---|
| | |
---|
| | |
---|
| | There are two Comparison Conditionals: |
---|
| | |
---|
| | .nf |
---|
| | .if string1 == string2 # True if string1 and string2 are identical |
---|
| | .if string1 != string2 # True if stringa and string2 are different |
---|
| | .fi |
---|
| | |
---|
| | As a general matter, you can put literal strings on both sides of such a |
---|
| | test, but the real value of these tests comes when you use variable |
---|
| | references within the tested strings. In this case, the value of the |
---|
| | variable |
---|
| | .B does matter. |
---|
| | It is the variable's value that is replaced in the string to test for |
---|
| | equality or inequality: |
---|
| | |
---|
| | .nf |
---|
| | MyName = Tconfpy |
---|
| | |
---|
| | .if [MyName] == Tconfpy |
---|
| | MyAge = 100.1 |
---|
| | |
---|
| | .else |
---|
| | MyAge = Unknown |
---|
| | |
---|
| | .fi |
---|
| | .fi |
---|
| | |
---|
| | These are particularly useful when used in combination with the \*(TC |
---|
| | Predefinded Variable or environment variables. You can build configurations |
---|
| | that "sense" what system is currently running and "adapt" accordingly: |
---|
| | |
---|
| | .nf |
---|
| | AppFiles = MyAppFiles |
---|
| | |
---|
| | .if [.OSNAME] == FreeBSD |
---|
| | files = [$HOME]/[AppFiles] |
---|
| | .endif |
---|
| | |
---|
| | .if [.OSNAME] == Windows |
---|
| | files = [$USERPROFILE]\\[AppFiles] |
---|
| | .endif |
---|
| | |
---|
| | .ifnone [files] |
---|
| | ErrorMessage = I don't know what kind of system I am running! |
---|
| | .endif |
---|
| | .fi |
---|
| | |
---|
| | |
---|
| | .SS The \'.literal\. Directive |
---|
| | |
---|
| | .SH ADVANCED TOPICS |
---|
| |
---|
| | |