@@ -0,0 +1,1358 @@
+package picocli.examples.inheritedoptions;%0A%0Aimport picocli.AutoComplete;%0Aimport picocli.CommandLine;%0Aimport picocli.CommandLine.Command;%0Aimport picocli.CommandLine.Model.CommandSpec;%0Aimport picocli.CommandLine.Option;%0A%0A/**%0A * Demonstrates how to avoid DuplicateOptionAnnotationsException%0A * (inspired by https://github.com/remkop/picocli/issues/1673)%0A * in this case, an inherited --help option clashes with a%0A * subcommand that already has a --help option.%0A */%0A@Command(name = %22top%22 /*, subcommands = AutoComplete.GenerateCompletion.class*/)%0Apublic class DuplicateOptionsWorkaround implements Runnable %7B%0A%0A    @Option(names = %7B%22-h%22, %22--help%22%7D, scope = CommandLine.ScopeType.INHERIT, description = %22Display usage help and exit.%22)%0A    boolean usageHelpRequested;%0A%0A    public void run() %7B%0A        System.out.println(%22Hello, world!%22);%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        CommandLine top = new CommandLine(new DuplicateOptionsWorkaround());%0A%0A        // create a CommandSpec for the subcommand%0A        CommandSpec sub = CommandSpec.forAnnotatedObject(new AutoComplete.GenerateCompletion());%0A%0A        // remove the duplicate option from the subcommand%0A        sub.remove(sub.findOption(%22--help%22));%0A%0A        // add the subcommand manually%0A        top.addSubcommand(sub);%0A%0A        // and run the application%0A        top.execute(args);%0A    %7D%0A%7D%0A

add example workaround for inherited options DuplicateOptionAnnotationException