Command Line Parsing API in NetBeans Platform

Jaroslav Tulach integrated Command Line Parsing API to NetBeans platform this week. The API was already tested in DVB Central project.

I wrote simple OptionProcessor in few minutes:

import java.util.Collections;
import java.util.Map;
import java.util.Set;
import org.netbeans.api.sendopts.CommandException;
import org.netbeans.spi.sendopts.Env;
import org.netbeans.spi.sendopts.Option;
import org.netbeans.spi.sendopts.OptionProcessor;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;

public class MyOptions  extends OptionProcessor {
    private static Option message = Option.requiredArgument(Option.NO_SHORT_NAME, "message");
    
    public Set

The MyOptions processor is register in META-INF/sevices. The registration can by done by META-INF/services browser. The MyOptions provider display first parameter of -message parameter in message dialog box. For Example

./netbeans --message Hello
shows Hello message.

Comments:

Post a Comment:
Comments are closed for this entry.
About

xzajo

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today