[jboss-jira] [JBoss JIRA] (WFCORE-1469) Support match-comparison operation for if-command
Thomas Darimont (JIRA)
issues at jboss.org
Tue Apr 12 15:08:00 EDT 2016
Thomas Darimont created WFCORE-1469:
---------------------------------------
Summary: Support match-comparison operation for if-command
Key: WFCORE-1469
URL: https://issues.jboss.org/browse/WFCORE-1469
Project: WildFly Core
Issue Type: Feature Request
Components: CLI
Reporter: Thomas Darimont
Assignee: Alexey Loubyansky
Priority: Minor
Conditional expressions are great help for creating generic wildfly configurations with the CLI.
Currently the {{comparison-operations}} for the {{if-expression}} are limited to
- equal (==)
- not equal (!=)
- lesser than (<)
- not lesser than (>=)
- greater than (>)
- not greater than (<=)
I'd propose an additional comparison operation: a regex based match operation with the symbol {{~=}}
wheras the left operand is a string to match against the right operand which is a regex string.
This would enable a simple way to do feature flag detection via partial regex matches.
The following sequence demonstrates this use case:
[code]
-Dfeatures="activemq jgroups"
[code]
[code]
if (features ~= ".*activemq.*") of /:resolve-expression(expression=${features})
echo configuring activemq
end-if
if (features ~= ".*jgroups.*") of /:resolve-expression(expression=${features})
echo configuring jgroups
end-if
if (features ~= ".*postgres.*") of /:resolve-expression(expression=${features})
echo configuring postgres
end-if
[code]
Example:
[code]
[default at local:9990 /] if (features ~= ".*feature1.*") of /:resolve-expression(expression=${features})
[default at local:9990 /] echo configuring feature1
[default at local:9990 /] end-if
configuring feature1
[default at local:9990 /] if (features ~= ".*feature2.*") of /:resolve-expression(expression=${features})
[default at local:9990 /] echo configuring feature2
[default at local:9990 /] end-if
configuring feature1
[default at local:9990 /] if (features ~= ".*feature3.*") of /:resolve-expression(expression=${features})
[default at local:9990 /] echo configuring feature3
[default at local:9990 /] end-if
[default at local:9990 /]
[code]
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list