private static Command lookupCommand(String[] args) {
        if (args == null || args.length == 0) {
            return HELP;
        }
        String abbrev = args[0];
        Command hit = null;
        for (Command candidate : COMMANDS) {
            if (candidate.mName.startsWith(abbrev)) {
                if (hit != null) {
                    // i.e. type more letters.
                    return HELP;
                }
                // Don't break.
                // Continue checking for ambiguous matches.
                hit = candidate;
            }
        }

        if (hit != null && hit.canParse(args)) {
            return hit;
        }
        return HELP;
    }