001/*
002 * JDrupes MDoclet
003 * Copyright (C) 2017, 2021 Michael N. Lipp
004 * 
005 * This program is free software; you can redistribute it and/or modify it 
006 * under the terms of the GNU Affero General Public License as published by 
007 * the Free Software Foundation; either version 3 of the License, or 
008 * (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful, but 
011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
012 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License 
013 * for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License along 
016 * with this program; if not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jdrupes.mdoclet;
020
021import java.util.List;
022
023import jdk.javadoc.doclet.Doclet;
024
025/**
026 * Defines the command line options.
027 */
028public abstract class MDocletOption implements Doclet.Option {
029
030    private String name;
031    private int argCount;
032
033    public MDocletOption(String name, int argCount) {
034        super();
035        this.name = name;
036        this.argCount = argCount;
037    }
038
039    @Override
040    public int getArgumentCount() {
041        return argCount;
042    }
043
044    @Override
045    public String getDescription() {
046        return name;
047    }
048
049    @Override
050    public Kind getKind() {
051        return Kind.STANDARD;
052    }
053
054    @Override
055    public List<String> getNames() {
056        return List.of((name.length() == 1 ? "-" : "--") + name);
057    }
058
059    @Override
060    public String getParameters() {
061        return "<>";
062    }
063
064}