Source Code Cross Referenced for HelpFormatterExamples.java in  » Library » Apache-command-line » org » apache » commons » cli » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache command line » org.apache.commons.cli 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */package org.apache.commons.cli;
017:
018:        /** 
019:         * A sample program shpwing the use of Options and the HelpFormatter class 
020:         *
021:         * @author Slawek Zachcial
022:         **/
023:        public class HelpFormatterExamples {
024:            // --------------------------------------------------------------- Constants
025:
026:            // ------------------------------------------------------------------ Static
027:
028:            public static void main(String[] args) {
029:                System.out.println("\n#\n# 'man' example\n#");
030:                manExample();
031:                /*
032:                 System.out.println("\n#\n# 'bzip2' example\n#");
033:                 bzip2Example();
034:                 System.out.println("\n#\n# 'ls' example\n#");
035:                 lsExample();
036:                 */
037:            }
038:
039:            static void manExample() {
040:                String cmdLine = "man [-c|-f|-k|-w|-tZT device] [-adlhu7V] [-Mpath] [-Ppager] [-Slist] "
041:                        + "[-msystem] [-pstring] [-Llocale] [-eextension] [section] page ...";
042:                Options opts = new Options()
043:                        .addOption("a", "all", false,
044:                                "find all matching manual pages.")
045:                        .addOption("d", "debug", false,
046:                                "emit debugging messages.")
047:                        .addOption("e", "extension", false,
048:                                "limit search to extension type 'extension'.")
049:                        .addOption("f", "whatis", false,
050:                                "equivalent to whatis.")
051:                        .addOption("k", "apropos", false,
052:                                "equivalent to apropos.")
053:                        .addOption("w", "location", false,
054:                                "print physical location of man page(s).")
055:                        .addOption("l", "local-file", false,
056:                                "interpret 'page' argument(s) as local filename(s)")
057:                        .addOption("u", "update", false,
058:                                "force a cache consistency check.")
059:                        .
060:                        //FIXME - should generate -r,--prompt string
061:                        addOption("r", "prompt", true,
062:                                "provide 'less' pager with prompt.")
063:                        .addOption("c", "catman", false,
064:                                "used by catman to reformat out of date cat pages.")
065:                        .addOption("7", "ascii", false,
066:                                "display ASCII translation or certain latin1 chars.")
067:                        .addOption("t", "troff", false,
068:                                "use troff format pages.")
069:                        .
070:                        //FIXME - should generate -T,--troff-device device
071:                        addOption("T", "troff-device", true,
072:                                "use groff with selected device.")
073:                        .addOption("Z", "ditroff", false,
074:                                "use groff with selected device.")
075:                        .addOption("D", "default", false,
076:                                "reset all options to their default values.")
077:                        .
078:                        //FIXME - should generate -M,--manpath path
079:                        addOption("M", "manpath", true,
080:                                "set search path for manual pages to 'path'.")
081:                        .
082:                        //FIXME - should generate -P,--pager pager
083:                        addOption("P", "pager", true,
084:                                "use program 'pager' to display output.")
085:                        .
086:                        //FIXME - should generate -S,--sections list
087:                        addOption("S", "sections", true,
088:                                "use colon separated section list.")
089:                        .
090:                        //FIXME - should generate -m,--systems system
091:                        addOption("m", "systems", true,
092:                                "search for man pages from other unix system(s).")
093:                        .
094:                        //FIXME - should generate -L,--locale locale
095:                        addOption("L", "locale", true,
096:                                "defaine the locale for this particular man search.")
097:                        .
098:                        //FIXME - should generate -p,--preprocessor string
099:                        addOption(
100:                                "p",
101:                                "preprocessor",
102:                                true,
103:                                "string indicates which preprocessor to run.\n"
104:                                        + " e - [n]eqn  p - pic     t - tbl\n"
105:                                        + " g - grap    r - refer   v - vgrind")
106:                        .addOption("V", "version", false, "show version.")
107:                        .addOption("h", "help", false,
108:                                "show this usage message.");
109:
110:                HelpFormatter hf = new HelpFormatter();
111:                //hf.printHelp(cmdLine, opts);
112:                hf.printHelp(60, cmdLine, null, opts, null);
113:            }
114:
115:            static void bzip2Example() {
116:                System.out.println("Coming soon");
117:            }
118:
119:            static void lsExample() {
120:                System.out.println("Coming soon");
121:            }
122:
123:            // -------------------------------------------------------------- Attributes
124:
125:            // ------------------------------------------------------------ Constructors
126:
127:            // ------------------------------------------------------------------ Public
128:
129:            // --------------------------------------------------------------- Protected
130:
131:            // ------------------------------------------------------- Package protected   
132:
133:            // ----------------------------------------------------------------- Private
134:
135:            // ----------------------------------------------------------- Inner classes
136:
137:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.