I want to process options that get passed to a package with kvoptions
.
The string is then saved in \bugs@errorlevel
.
I want to test if it contains one of [info, warning, error] and
set a command accordingly.
I could think of setting a bool variable to false and test as long as it has been set true or remains false. That could be done by cascading if expressions.
Testing strings for being equal can for example be done with etoolbox
's \ifstrequal
or xstring
's \IfStrEq
. Both are of the \ifthen
package type using brackets.
On the other hand a 'real' switch could be done with the package boolexpr
.
However in that case I need commands which return a pure bool expression, which neither of the above commands do. The sequence principle would be:
\switch
\case{6>1 \AND 6<=5}$\geq 1$ and $\leq 5$%
\case{3<10}$> 5$ and $< 10$%
\case{3>10}$\geq 10$%
\endswitch
However I do not now what to enter in the case structure for comparison of strings. In the end it should be something like
\switch
\case{\isequal{\bugs@errorlevel}{info}}
\renewcommand\tplbugs@BugAction[1]{\PackageInfo{templatebugs}{#1}{}}%
\case{\isequal{\bugs@errorlevel}{warning}}
\renewcommand\tplbugs@BugAction[1]{\PackageWarning{templatebugs}{#1}{}}%
\case{\isequal{\bugs@errorlevel}{error}}
\renewcommand\tplbugs@BugAction[1]{\PackageError{templatebugs}{#1}{}}%
\otherwise
\PackageError{templatebugs}{
\MessageBreak
value >\bugs@errorlevel< unkown \MessageBreak
possible values are: info,warning,error. \MessageBreak
}{}
\endswitch
but that code does not work, since \isequal
does not exist.