[Groovy] Class CommandArgumentParser

  • org.apache.groovy.groovysh.util.CommandArgumentParser
@CompileStatic
class CommandArgumentParser
extends Object

Constructor Summary

Constructors
Constructor and description
CommandArgumentParser ()

Methods Summary

Methods
Type Params Return Type Name and description
static List<String> parseLine(String untrimmedLine, int numTokensToCollect)
takes a String and tokenizes it according to posix-shell-like rules, meaning arguments are separated by non-escaped 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

Constructor Detail

CommandArgumentParser()

Method Detail

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

takes a String and tokenizes it according to posix-shell-like rules, meaning arguments are separated by non-escaped 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\", ""] @return

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

© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/apache/groovy/groovysh/util/CommandArgumentParser.html