package potaufeu;

import static potaufeu.Messages.message;
import static potaufeu.PackagePrivate.flatten;
import java.util.*;
import java.util.stream.*;

/**
 * Messages for `verbose' option.
 */
public final class VerboseMessages {

    private VerboseMessages() {
    }

    public static String patterns(OptionSet opts) {
        // @formatter:off
        return flatten(
            Stream.of(
                format("path", opts.getPathPatterns()),
                format("exts", opts.getExtensionPatterns()),
                format("name", opts.getNamePatterns()),
                format("exclude", opts.getExclusionPatterns()),
                format("size", opts.getFileSizePatterns()),
                format("ctime", opts.getCtimePatterns()),
                format("mtime", opts.getMtimePatterns()),
                format("atime", opts.getAtimePatterns()),
                format("file only", opts.isFile()),
                format("text file", opts.isText())))
            .collect(Collectors.joining(", "));
        // @formatter:on
    }

    public static String options(OptionSet opts) {
        // @formatter:off
        return flatten(
            Stream.of(
                format("dir", opts.getDirectories()),
                format("quiet", opts.isQuiet()),
                format("full path", opts.isPrintsFullpath()),
                format("list", opts.isPrintsList()),
                format("list-posix", opts.isPrintsPosixLikeList()),
                format("list-detail", opts.isPrintsDetailList()),
                format("list-linecount", opts.isPrintsLineCount()),
                format("sortkeys", opts.getSortKeys()),
                format("slash", opts.isSlash()),
                format("head", opts.getHeadCount()),
                format("tail", opts.getTailCount())))
            .collect(Collectors.joining(", "));
        // @formatter:on
    }

    public static String end(long matchedCount, long allFileCount, long elapsed) {
        return message("i.verboseEndMessage", matchedCount, allFileCount, elapsed / 1_000f);
    }

    private static Optional<String> format(String optionKey, Collection<String> a) {
        return (a.isEmpty()) ? Optional.empty() : Optional.of(String.format("%s:%s", optionKey, a));
    }

    private static Optional<String> format(String optionKey, boolean exists) {
        return (exists) ? Optional.of(optionKey) : Optional.empty();
    }

    private static Optional<String> format(String optionKey, OptionalInt optInt) {
        return (optInt.isPresent()) ? Optional.of(optionKey + " " + optInt.getAsInt()) : Optional.empty();
    }

}

@@ -891,17 +891,17 @@
 at(%22file
- 
+-
 only%22, o
@@ -943,17 +943,17 @@
 at(%22text
- 
+-
 file%22, o
@@ -961,24 +961,80 @@
 ts.isText())
+,%0A                format(%22grep%22, opts.getGrepPatterns())
 ))%0A         
@@ -1278,24 +1278,81 @@
 ctories()),%0A
+                format(%22max-depth%22, opts.getMaxDepth()),%0A
             
@@ -1914,16 +1914,65 @@
 Count())
+,%0A                format(%22state%22, opts.isState())
 ))%0A     
@@ -2726,11 +2726,11 @@
 y + 
-%22 %22
+'='
  + o

Add missing messages for "max-depth", "grep", and "state" in the verbose option