Package org.apache.maven.shared.utils.cli

Examples of org.apache.maven.shared.utils.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

    public static void launchSubversion( String line, String basedir )
        throws VerificationException
    {
        try
        {
            Commandline cli = new Commandline( line );

            cli.setWorkingDirectory( basedir );

            Writer logWriter = new FileWriter( new File( basedir, LOG_FILENAME ) );

            StreamConsumer out = new WriterStreamConsumer( logWriter );

            StreamConsumer err = new WriterStreamConsumer( logWriter );

            System.out.println( "Command: " + CommandLineUtils.toString( cli.getCommandline() ) );

            int ret = CommandLineUtils.executeCommandLine( cli, out, err );

            logWriter.close();
View Full Code Here

    }

    public int run( String[] cliArgs, Map envVars, String workingDirectory, File logFile )
        throws IOException, LauncherException
    {
        Commandline cmd = new Commandline();

        cmd.setExecutable( executable );

        if ( mavenHome != null )
        {
            cmd.addEnvironment( "M2_HOME", mavenHome );
        }

        if ( envVars != null )
        {
            for ( Object o : envVars.keySet() )
            {
                String key = (String) o;

                cmd.addEnvironment( key, (String) envVars.get( key ) );
            }
        }

        if ( envVars == null || envVars.get( "JAVA_HOME" ) == null )
        {
            cmd.addEnvironment( "JAVA_HOME", System.getProperty( "java.home" ) );
        }

        cmd.addEnvironment( "MAVEN_TERMINATE_CMD", "on" );

        cmd.setWorkingDirectory( workingDirectory );

        for ( String cliArg : cliArgs )
        {
            cmd.createArg().setValue( cliArg );
        }

        Writer logWriter = new FileWriter( logFile );

        StreamConsumer out = new WriterStreamConsumer( logWriter );
View Full Code Here

        throws IOException, SurefireBooterForkException
    {
        ForkConfiguration config = getForkConfiguration( null, "java" );
        File cpElement = getTempClasspathFile();

        Commandline cli =
            config.createCommandLine( Collections.singletonList( cpElement.getAbsolutePath() ), true, false, null, 1 );

        String line = StringUtils.join( cli.getCommandline(), " " );
        assertTrue( line.contains( "-jar" ) );
    }
View Full Code Here

    {
        // SUREFIRE-657
        File cpElement = getTempClasspathFile();
        ForkConfiguration forkConfiguration = getForkConfiguration( "abc\ndef", null );

        final Commandline commandLine =
            forkConfiguration.createCommandLine( Collections.singletonList( cpElement.getAbsolutePath() ), false, false,
                                                 null, 1 );
        assertTrue( commandLine.toString().contains( "abc def" ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.shared.utils.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.