All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jline.console.ArgDesc Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2002-2021, the original author or authors.
 *
 * This software is distributable under the BSD license. See the terms of the
 * BSD license in the documentation provided with this software.
 *
 * https://opensource.org/licenses/BSD-3-Clause
 */
package org.jline.console;

import java.util.ArrayList;
import java.util.List;

import org.jline.utils.AttributedString;

public class ArgDesc {
    private final String name;
    private final List description;

    public ArgDesc(String name) {
        this(name, new ArrayList<>());
    }

    public ArgDesc(String name, List description) {
        if (name.contains("\t") || name.contains(" ")) {
            throw new IllegalArgumentException("Bad argument name: " + name);
        }
        this.name = name;
        this.description = new ArrayList<>(description);
    }

    public String getName() {
        return name;
    }

    public List getDescription() {
        return description;
    }

    public static List doArgNames(List names) {
        List out = new ArrayList<>();
        for (String n: names) {
            out.add(new ArgDesc(n));
        }
        return out;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy