public static void main()

in tooling/cli/src/main/java/org/apache/karaf/minho/tooling/cli/Main.java [28:71]


    public static void main(String[] args) throws Exception {
        Options options = new Options();
        options.addOption(new Option("f", "file", true, "Location of the minho-build.json file"));
        options.addOption(new Option("h", "help", false, "print this message"));

        CommandLineParser parser = new DefaultParser();
        CommandLine cmd = parser.parse(options, args);

        if (cmd.hasOption("help")) {
            HelpFormatter helpFormatter = new HelpFormatter();
            helpFormatter.printHelp("minho-build [package|jar|archive] \nDefault build action is package", options);
            System.exit(1);
        }

        File minhoBuild;
        if (cmd.hasOption("file")) {
            minhoBuild = new File(cmd.getOptionValue("file"));
        } else {
            minhoBuild = new File("minho-build.json");
        }

        if (!minhoBuild.exists()) {
            System.err.println("minho-build.json file not found");
            System.exit(1);
        }

        String action = "package";

        if (cmd.getArgList().size() == 1) {
            action = cmd.getArgList().get(0);
        }

        if (action.equalsIgnoreCase("package")) {
            Runtime.createPackage(new FileInputStream(minhoBuild));
        } else if (action.equalsIgnoreCase("jar")) {
            Runtime.createJar(new FileInputStream(minhoBuild));
        } else if (action.equalsIgnoreCase("archive")) {
            Runtime.createArchive(new FileInputStream(minhoBuild));
        } else {
            System.err.println("Build action argument is not valid. It should be package|jar|archive");
            System.exit(1);
        }

    }