Package org.codehaus.plexus.util.cli

Examples of org.codehaus.plexus.util.cli.Commandline$Argument


                    }

                    // TODO: why do we iterate over all anonymous arguments?
                    // canProcess will always return true?
                    for (final Iterator i = anonymous.iterator(); i.hasNext();) {
                        final Argument argument = (Argument) i.next();

                        if (argument.canProcess(commandLine, arguments)) {
                            argument.process(commandLine, arguments);
                        }
                    }
                } // [END argument is NOT anonymous
            } // [END option NOT found
        } // [END process each command line token
View Full Code Here


     *
     * @return A new Argument instance using the options specified in this
     * ArgumentBuilder.
     */
    public final Argument create() {
        final Argument argument =
            new ArgumentImpl(
                name,
                description,
                minimum,
                maximum,
View Full Code Here

    private void createOption(
        final char type,
        final boolean required,
        final char opt) {
        final Argument argument;
        if (type != ' ') {
            abuilder.reset();
            abuilder.withValidator(validator(type));
            if (required) {
                abuilder.withMinimum(1);
View Full Code Here

    }
  }
 
  private Option createOption(String name, String desc,
                              String argName, int max, boolean required){
    Argument argument = argBuilder.
      withName(argName).
      withMinimum(1).
      withMaximum(max).
      create();
    return builder.
View Full Code Here

  }
 
  private Option createOption(String name, String desc,
                              String argName, int max, boolean required, Validator validator){
   
    Argument argument = argBuilder.
      withName(argName).
      withMinimum(1).
      withMaximum(max).
      withValidator(validator).
      create();
View Full Code Here

        GroupBuilder gBuilder = new GroupBuilder();

        /**
         *  OUTPUT Option
         */
        Argument outputPath = aBuilder.withName("output path").withMinimum(1).withMaximum(1).create();
        Option outputOption = oBuilder.withLongName("output")
                                      .withDescription("Path to generated output file")
                                      .withArgument(outputPath).create();

        /**
         *  GCP Option
         */
        Argument GCPPath = aBuilder.withName("path").withMinimum(1).withMaximum(1).create();
        Option inputOption = oBuilder.withLongName("input").withDescription("File with GCPs")
                                     .withArgument(GCPPath).create();

        /**
         * Set skew option
         */
        Argument skewArg = aBuilder.withName("skew").withMinimum(1).withMaximum(1).create();
        Option setSkew = oBuilder.withLongName("skew")
                                 .withDescription("Sets exlipcitly the value of skew parameter ")
                                 .withArgument(skewArg).create();

        /**
         * Set rotation option
         */
        Argument phiArg = aBuilder.withName("rotation").withMinimum(1).withMaximum(1).create();
        Option setPhi = oBuilder.withLongName("phi")
                                .withDescription("Sets exlipcitly the value of rotation parameter (in radians)")
                                .withArgument(phiArg).create();

        Option statistics = oBuilder.withLongName("s")
View Full Code Here

    mainParams.add("localeList=" + localeList);
    mainParams.add("internStrings=false");
    mainParams.add("action=release");
    mainParams.add("layerOptimize=" + layerOptimize);
    mainParams.add("profileFile=" + profilePath);
    Commandline commandLine = new Commandline();
    commandLine.setExecutable(javaExec);
    commandLine.setWorkingDirectory(dojoDirectory + "/util/buildscripts");
    List<String> commandArgs = new ArrayList<String>();
    // add the class path
    if (classpathArgs.size() > 0) {
      commandArgs.add("-classpath");
      String classpath = "";
      for (int i = 0; i < classpathArgs.size(); i++) {
        classpath += (i == 0 ? "" : File.pathSeparator);
        classpath += classpathArgs.get(i);
      }
      commandArgs.add(classpath);
    }
    // add the rest...
    commandArgs.add(mainClass);
    commandArgs.add(buildFile);
    for (String param : mainParams) {
      commandArgs.add(param);
    }
    commandLine.addArguments(commandArgs.toArray(new String[commandArgs.size()]));

    try {
      log.info("Executing " + commandLine.toString());
      int resultCode = CommandLineUtils.executeCommandLine(commandLine, new LogStream(), new LogStream());
      if (resultCode > 0) {
        throw new MojoExecutionException("Result of " + commandLine + " execution is: '" + resultCode + "'.");
      }
    } catch (CommandLineException e) {
View Full Code Here

    private static void fixScriptPermissions( File binDirectory )
        throws InterruptedException, CommandLineException
    {
        if ( Os.isFamily( "unix" ) )
        {
            Commandline cli = new Commandline();

            cli.setExecutable( "chmod" );

            cli.createArgument().setValue( "+x" );

            cli.createArgument().setValue( new File( binDirectory, "mvn" ).getAbsolutePath() );

            cli.createArgument().setValue( new File( binDirectory, "m2" ).getAbsolutePath() );

            cli.execute().waitFor();
        }
    }
View Full Code Here

    }

    private void runMaven( File installation, File basedir, String[] args )
        throws Exception, InterruptedException
    {
        Commandline cli = new Commandline();

        cli.setExecutable( new File( installation, "bin/mvn" ).getAbsolutePath() );

        cli.setWorkingDirectory( basedir.getAbsolutePath() );

        cli.createArgument().setValue( "-e" );
        cli.createArgument().setValue( "--batch-mode" );

        if ( offline )
        {
            cli.createArgument().setValue( "-o" );
        }
        if ( updateSnapshots )
        {
            cli.createArgument().setValue( "--update-snapshots" );
        }

        for ( int i = 0; i < args.length; i++ )
        {
            cli.createArgument().setValue( args[i] );
        }

        System.out.println( "Running Maven... " );
        System.out.println( cli.toString() );

        int exitCode = CommandLineUtils.executeCommandLine( cli,
                                                            new WriterStreamConsumer( new PrintWriter( System.out ) ),
                                                            new WriterStreamConsumer( new PrintWriter( System.err ) ) );
View Full Code Here

                // hackhish defaut commandline tools not support ; or && so write a file with the script
                // and "/bin/sh -e " + tmpFile.getPath();
                FileUtils.fileWrite( tmpFile, commandLine );

                Commandline cl = new Commandline();
                cl.setExecutable( "/bin/sh" );
                //cl.createArg().setValue( "-e" );
                //cl.createArg().setValue( tmpFile.getPath() );
                cl.createArg().setFile( tmpFile );

                exitValue = CommandLineUtils.executeCommandLine( cl, stdout, stderr );
                System.out.println( "exit value " + exitValue );
                /*
                if ( exitValue == 0 )
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.util.cli.Commandline$Argument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.