com.github.timm.cucumber.options.Shellwords Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cucumber-jvm-parallel-plugin Show documentation
Show all versions of cucumber-jvm-parallel-plugin Show documentation
Plugin for assisting with running Cucumber-JVM features in parallel
The newest version!
package com.github.timm.cucumber.options;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Copyright (c) 2008-2014 The Cucumber Organisation
*
* Copy of Cucumber Shellwords
*/
public class Shellwords {
private static final Pattern SHELLWORDS_PATTERN = Pattern.compile("[^\\s']+|'([^']*)'");
public static List parse(final String cmdline) {
final List matchList = new ArrayList();
final Matcher shellwordsMatcher = SHELLWORDS_PATTERN.matcher(cmdline);
while (shellwordsMatcher.find()) {
if (shellwordsMatcher.group(1) != null) {
matchList.add(shellwordsMatcher.group(1));
} else {
matchList.add(shellwordsMatcher.group());
}
}
return matchList;
}
}