@@ -0,0 +1,2490 @@
+/*%0A   Copyright 2017 Remko Popma%0A%0A   Licensed under the Apache License, Version 2.0 (the %22License%22);%0A   you may not use this file except in compliance with the License.%0A   You may obtain a copy of the License at%0A%0A       http://www.apache.org/licenses/LICENSE-2.0%0A%0A   Unless required by applicable law or agreed to in writing, software%0A   distributed under the License is distributed on an %22AS IS%22 BASIS,%0A   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A   See the License for the specific language governing permissions and%0A   limitations under the License.%0A */%0Apackage picocli.examples.subcommands;%0A%0Aimport java.util.Locale;%0A%0Aimport picocli.CommandLine;%0Aimport picocli.CommandLine.Command;%0Aimport picocli.CommandLine.Parameters;%0A%0Apublic class SubcommandDemo %7B%0A%0A    @Command(name = %22ISOCodeResolve%22, subcommands = %7B Subcommand1.class, Subcommand2.class,%0A            CommandLine.HelpCommand.class %7D, description = %22Resolve ISO country codes (ISO-3166-1) or language codes (ISO 639-1 or -2)%22)%0A    static class ParentCommand implements Runnable %7B%0A%0A        @Override%0A        public void run() %7B %7D%0A    %7D%0A%0A    @Command(name = %22country%22, description = %22Resolve ISO country code (ISO-3166-1, Alpha-2 code)%22)%0A    static class Subcommand1 implements Runnable %7B%0A%0A        @Parameters(arity = %221..*%22, paramLabel = %22%3Ccountry1%3E %3Ccountry2%3E%22, description = %22country code(s) to be resolved%22)%0A        private String%5B%5D countryCodes;%0A%0A        @Override%0A        public void run() %7B%0A            for (String code : countryCodes) %7B%0A                System.out.println(String.format(%22%25s: %25s%22, code.toUpperCase(), new Locale(%22%22, code).getDisplayCountry()));%0A            %7D%0A        %7D%0A    %7D%0A%0A    @Command(name = %22language%22, description = %22Resolve ISO language code (ISO 639-1 or -2, two/three letters)%22)%0A    static class Subcommand2 implements Runnable %7B%0A%0A        @Parameters(arity = %221..*%22, paramLabel = %22%3Ccode%3E %3Ccode2%3E%22, description = %22language code(s) to be resolved%22)%0A        private String%5B%5D languageCodes;%0A%0A        @Override%0A        public void run() %7B%0A            for (String code : languageCodes) %7B%0A                System.out.println(String.format(%22%25s: %25s%22, code.toLowerCase(), new Locale(code).getDisplayLanguage()));%0A            %7D%0A        %7D%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        CommandLine cmd = new CommandLine(new ParentCommand());%0A        cmd.parseWithHandler(new CommandLine.RunAll(), args);%0A%0A        if (args.length == 0) %7B cmd.usage(System.out); %7D%0A    %7D%0A%7D

Add subcommand demo example