[Groovy] Class CommandArgumentParser

  • org.codehaus.groovy.tools.shell.util.CommandArgumentParser

Methods Summary

Methods
Type Params Return Type Name and description
static List<String> parseLine(String untrimmedLine, int numTokensToCollect = -1)
takes a String and tokenizes it according to posix-shell-like rules, meaning arguments are separated by blanks or hyphens, and hyphens wrap tokens regardless of blanks, other hyphens or escaped hyphens within the wrapping hyphens.

Inherited Methods Summary

Inherited Methods
Methods inherited from class Name
class Object wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Method Detail

static List<String> parseLine(String untrimmedLine, int numTokensToCollect = -1)

takes a String and tokenizes it according to posix-shell-like rules, meaning arguments are separated by blanks or hyphens, and hyphens wrap tokens regardless of blanks, other hyphens or escaped hyphens within the wrapping hyphens. Example: "foo bar 123'456' 'abc\'def\\' ''" has 6 tokens: ["foo", "bar", "123", "456", "abc'def\", ""]

Parameters:
untrimmedLine
numTokensToCollect - stop processing after so many tokens, negative means unlimited
Returns:

© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/2.4.21/html/gapi/org/codehaus/groovy/tools/shell/util/CommandArgumentParser.html