separate_arguments.rst 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. separate_arguments
  2. ------------------
  3. Parse space-separated arguments into a semicolon-separated list.
  4. ::
  5. separate_arguments(<var> <UNIX|WINDOWS>_COMMAND "<args>")
  6. Parses a unix- or windows-style command-line string "<args>" and
  7. stores a semicolon-separated list of the arguments in ``<var>``. The
  8. entire command line must be given in one "<args>" argument.
  9. The ``UNIX_COMMAND`` mode separates arguments by unquoted whitespace. It
  10. recognizes both single-quote and double-quote pairs. A backslash
  11. escapes the next literal character (``\"`` is ``"``); there are no special
  12. escapes (``\n`` is just ``n``).
  13. The ``WINDOWS_COMMAND`` mode parses a windows command-line using the same
  14. syntax the runtime library uses to construct argv at startup. It
  15. separates arguments by whitespace that is not double-quoted.
  16. Backslashes are literal unless they precede double-quotes. See the
  17. MSDN article `Parsing C Command-Line Arguments`_ for details.
  18. .. _`Parsing C Command-Line Arguments`: https://msdn.microsoft.com/library/a1y7w461.aspx
  19. ::
  20. separate_arguments(<var>)
  21. Convert the value of ``<var>`` to a semi-colon separated list. All
  22. spaces are replaced with ';'. This helps with generating command
  23. lines.