package org.kohsuke.args4j.spi;

import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.OptionDef;

/**
 * {@link OptionHandler} for the option terminator <tt>--</tt>.
 *
 * <p>
 * This {@link OptionHandler} can be used to implement the special token
 * <tt>--</tt> that indicates that the rest of tokens are not options, but arguments.
 *
 * <p>
 * For example, if you have the following class:
 *
 * <pre>
 * {@code 
 * class Foo {
 *   &#64;Argument
 *   &#64;Option(name="--",handler={@link StopOptionHandler}.class)
 *   List&lt;String> args;
 *
 *   &#64;Option(name="-n")
 *   int n;
 * }
 * }</pre>
 *
 * <p>
 * The command line <code>-n 5 abc def</code> would parse into {@code n=5, args={"abc",def"}},
 * but <code> -- -n 5 abc def</code> would parse into {@code n=0, args={"-n","5","abc","def"}}.
 *
 * @author Kohsuke Kawaguchi
 */
public class StopOptionHandler extends OptionHandler<String> {
    public StopOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super String> setter) {
        super(parser, option, setter);
    }

    @Override
    public int parseArguments(Parameters params) throws CmdLineException {
    	owner.stopOptionParsing();
    	return 0;
    }

    @Override
    public String getDefaultMetaVariable() {
        return Messages.DEFAULT_META_REST_OF_ARGUMENTS_HANDLER.format();
    }
}

@@ -460,22 +460,22 @@
 pre%3E%0A * 
-%7B@
+%3C
 code
+%3E
  %0A * cla
@@ -487,22 +487,28 @@
 o %7B%0A *  
- &#64;
+%7B@literal @%7D
 Argument
@@ -508,30 +508,36 @@
 rgument%0A *  
- &#64;
+%7B@literal @%7D
 Option(name=
@@ -620,14 +620,20 @@
  *  
- &#64;
+%7B@literal @%7D
 Opti
@@ -666,17 +666,23 @@
  * %7D%0A * 
-%7D
+%3C/code%3E
 %3C/pre%3E%0A 

Fix for @ sign, part 2