public static org.hamcrest.Matcher<java.lang.String> startsWith(java.lang.String substring) { return org.hamcrest.text.StringStartsWith.startsWith(substring); }
@Factory public static Matcher<String> startsWith(String substring) { return new StringStartsWith(substring); }
@Override public boolean matchesSafely(final String actual) { return super.matchesSafely(StringUtils.stripNewLines(actual)); }
@Override public boolean matchesSafely(final String actual) { return super.matchesSafely(StringUtils.stripNewLines(actual)); }
@Override public boolean matchesSafely(final String actual) { return super.matchesSafely(StringUtils.stripNewLines(actual)); }
@Override public int complete(String buffer, int cursor, List<CharSequence> candidates) { Preconditions.checkNotNull(candidates); String text = contextualBuffer(buffer, cursor); List<String> commands = Lambda.filter(StringStartsWith.startsWith(text), this.commands); if(commands.size()>0) { candidates.addAll(commands); if(candidates.size()==1) { candidates.set(0, candidates.get(0) + " "); } return candidates.isEmpty() ? -1 : 0; } else if(text.contains(" ")) { int insertion = text.lastIndexOf(" ") + 1; String tailBuffer = text.substring(insertion); List<String> files = Lambda.convert(Lambda.convert(SpashFileSystem.get().ls(this.session.getWorkingDir()).collect(), new PropertyExtractor<Object, Path>("fileName")), new DefaultStringConverter()); files = Lambda.filter(StringStartsWith.startsWith(tailBuffer), files); candidates.addAll(files); if(candidates.size()==1) { candidates.set(0, candidates.get(0) + " "); } return candidates.isEmpty() ? -1 : insertion; } return -1; }