| 1 | package org.etsi.common.configuration; |
|---|
| 2 | |
|---|
| 3 | import org.apache.commons.cli.Options; |
|---|
| 4 | |
|---|
| 5 | public class OptionsHandler { |
|---|
| 6 | |
|---|
| 7 | private Options options = new Options(); |
|---|
| 8 | |
|---|
| 9 | public OptionsHandler() { |
|---|
| 10 | this.initialize(); |
|---|
| 11 | } |
|---|
| 12 | |
|---|
| 13 | private void initialize() { |
|---|
| 14 | |
|---|
| 15 | OptionWithID optionWithID; |
|---|
| 16 | |
|---|
| 17 | optionWithID = new OptionWithID(9, "generate-config", "Generate a new default configuration file at the specified file location"); |
|---|
| 18 | optionWithID.setArgs(1); |
|---|
| 19 | optionWithID.setArgName("FILE NAME"); |
|---|
| 20 | getOptions().addOption(optionWithID); |
|---|
| 21 | |
|---|
| 22 | optionWithID = new OptionWithID(10, "config", "Configuration file location\n"); |
|---|
| 23 | optionWithID.setArgs(1); |
|---|
| 24 | optionWithID.setArgName("FILE NAME"); |
|---|
| 25 | // optionWithID.setRequired(true); |
|---|
| 26 | getOptions().addOption(optionWithID); |
|---|
| 27 | |
|---|
| 28 | optionWithID = new OptionWithID(20, "profile", "Configuration profile\n"); |
|---|
| 29 | optionWithID.setArgs(1); |
|---|
| 30 | optionWithID.setArgName("PROFILE NAME"); |
|---|
| 31 | getOptions().addOption(optionWithID); |
|---|
| 32 | |
|---|
| 33 | optionWithID = new OptionWithID(30, "verbosity", "Verbosity level (currently supports ERROR, WARNING and INFORMATION values)\n"); |
|---|
| 34 | optionWithID.setArgs(1); |
|---|
| 35 | optionWithID.setArgName("LOG LEVEL"); |
|---|
| 36 | getOptions().addOption(optionWithID); |
|---|
| 37 | |
|---|
| 38 | optionWithID = new OptionWithID(40, "output-path", "Destination path for the output (if applicable, otherwise ignored). Overrides the profile setting.\n"); |
|---|
| 39 | optionWithID.setArgs(1); |
|---|
| 40 | optionWithID.setArgName("PATH"); |
|---|
| 41 | getOptions().addOption(optionWithID); |
|---|
| 42 | |
|---|
| 43 | optionWithID = new OptionWithID(100, "help", "Show this usage information screen\n"); |
|---|
| 44 | getOptions().addOption(optionWithID); |
|---|
| 45 | |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | public void setOptions(Options options) { |
|---|
| 49 | this.options = options; |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | public Options getOptions() { |
|---|
| 53 | return options; |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | } |
|---|