diff options
author | Marc Chevrier <marc.chevrier@sap.com> | 2018-03-26 12:32:12 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@sap.com> | 2018-04-16 15:11:53 (GMT) |
commit | dca2347980862d803c182bb5898b5bfaca54aa62 (patch) | |
tree | 2cc95f9ed2d017bc1eddb7446b60b2be3e8f04dc /Help | |
parent | cdae12f8f86730e075598118ebe5fd2f11746af7 (diff) | |
download | CMake-dca2347980862d803c182bb5898b5bfaca54aa62.zip CMake-dca2347980862d803c182bb5898b5bfaca54aa62.tar.gz CMake-dca2347980862d803c182bb5898b5bfaca54aa62.tar.bz2 |
list: Add TRANSFORM sub-command
Issue: #17823
Diffstat (limited to 'Help')
-rw-r--r-- | Help/command/list.rst | 73 | ||||
-rw-r--r-- | Help/release/dev/list-transform.rst | 5 |
2 files changed, 78 insertions, 0 deletions
diff --git a/Help/command/list.rst b/Help/command/list.rst index 6218a2a..9451d31 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -151,6 +151,79 @@ REMOVE_DUPLICATES Removes duplicated items in the list. +TRANSFORM +""""""""" + +:: + + list(TRANSFORM <list> <ACTION> [<SELECTOR>] + [OUTPUT_VARIABLE <output variable>]) + +Transforms the list by applying an action to all or, by specifying a +``<SELECTOR>``, to the selected elements of the list, storing result in-place +or in the specified output variable. + +.. note:: + + ``TRANSFORM`` sub-command does not change the number of elements of the + list. If a ``<SELECTOR>`` is specified, only some elements will be changed, + the other ones will remain same as before the transformation. + +``<ACTION>`` specify the action to apply to the elements of list. +The actions have exactly the same semantics as sub-commands of +:command:`string` command. + +The ``<ACTION>`` may be one of: + +``APPEND``, ``PREPEND``: Append, prepend specified value to each element of +the list. :: + + list(TRANSFORM <list> <APPEND|PREPEND> <value> ...) + +``TOUPPER``, ``TOLOWER``: Convert each element of the list to upper, lower +characters. :: + + list(TRANSFORM <list> <TOLOWER|TOUPPER> ...) + +``STRIP``: Remove leading and trailing spaces from each element of the +list. :: + + list(TRANSFORM <list> STRIP ...) + +``GENEX_STRIP``: Strip any +:manual:`generator expressions <cmake-generator-expressions(7)>` from each +element of the list. :: + + list(TRANSFORM <list> GENEX_STRIP ...) + +``REPLACE``: Match the regular expression as many times as possible and +substitute the replacement expression for the match for each element +of the list +(Same semantic as ``REGEX REPLACE`` from :command:`string` command). :: + + list(TRANSFORM <list> REPLACE <regular_expression> + <replace_expression> ...) + +``<SELECTOR>`` select which elements of the list will be transformed. Only one +type of selector can be specified at a time. + +The ``<SELECTOR>`` may be one of: + +``AT``: Specify a list of indexes. :: + + list(TRANSFORM <list> <ACTION> AT <index> [<index> ...] ...) + +``FOR``: Specify a range with, optionaly, an incerment used to iterate over +the range. :: + + list(TRANSFORM <list> <ACTION> FOR <start> <stop> [<step>] ...) + +``REGEX``: Specify a regular expression. Only elements matching the regular +expression will be transformed. :: + + list(TRANSFORM <list> <ACTION> REGEX <regular_expression> ...) + + Sorting ^^^^^^^ diff --git a/Help/release/dev/list-transform.rst b/Help/release/dev/list-transform.rst new file mode 100644 index 0000000..4a6dacc --- /dev/null +++ b/Help/release/dev/list-transform.rst @@ -0,0 +1,5 @@ +list-transform +-------------- + +* The :command:`list` command learned a ``TRANSFORM`` sub-command + to apply various string transformation to list's elements. |