1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package net.sourceforge.plantumldependency.cli.main.option.basedirectory;
26
27 import static java.util.Arrays.asList;
28 import static java.util.Collections.unmodifiableSet;
29 import static net.sourceforge.plantumldependency.common.constants.CharacterConstants.DOT_CHAR;
30 import static net.sourceforge.plantumldependency.common.constants.CharacterConstants.SPACE_CHAR;
31 import static net.sourceforge.plantumldependency.commoncli.option.status.OptionStatus.ACTIVE_OPTIONAL_OPTION_STATUS;
32
33 import java.io.File;
34 import java.util.Set;
35 import java.util.TreeSet;
36
37 import net.sourceforge.plantumldependency.commoncli.command.CommandLine;
38 import net.sourceforge.plantumldependency.commoncli.exception.CommandLineException;
39 import net.sourceforge.plantumldependency.commoncli.option.AbstractOptionWithArgument;
40 import net.sourceforge.plantumldependency.commoncli.option.argument.impl.directory.ExistingDirectoryOptionArgumentImpl;
41
42
43
44
45
46
47
48
49
50 public class PlantUMLDependencyBaseDirectoryOption extends AbstractOptionWithArgument < File > {
51
52
53 private static final long serialVersionUID = 2742023948261611955L;
54
55
56 public static final String OPTION_MAIN_SYNOPSIS = "-b";
57
58
59 public static final Set < String > OPTION_SYNOPSIS = unmodifiableSet(new TreeSet < String >(
60 asList(new String[] {"--basedir"})));
61
62
63
64
65
66
67 public PlantUMLDependencyBaseDirectoryOption() {
68 super(
69 OPTION_MAIN_SYNOPSIS,
70 OPTION_SYNOPSIS,
71 new ExistingDirectoryOptionArgumentImpl(true),
72 new StringBuilder(
73 "The base directory where to look for source files. If not specified, the default pattern is \".\" i.e. the directory where the program is launched from."),
74 SPACE_CHAR, ACTIVE_OPTIONAL_OPTION_STATUS);
75 }
76
77
78
79
80
81
82 @Override
83 public String getDefaultArgumentAsStringIfOptionNotSpecified(final CommandLine commandLine)
84 throws CommandLineException {
85 return DOT_CHAR;
86 }
87
88
89
90
91
92
93 @Override
94 public String getDefaultArgumentAsStringIfOptionSpecified(final CommandLine commandLine)
95 throws CommandLineException {
96 return DOT_CHAR;
97 }
98 }