1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
6 <!-- 2023-10-29 Sun 23:27 -->
7 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8 <meta name="viewport" content="width=device-width, initial-scale=1" />
9 <title>CLI Helper - library to help implementing commandline interfaces</title>
10 <meta name="author" content="Svjatoslav Agejenko" />
11 <meta name="generator" content="Org Mode" />
13 #content { max-width: 60em; margin: auto; }
14 .title { text-align: center;
15 margin-bottom: .2em; }
16 .subtitle { text-align: center;
20 .todo { font-family: monospace; color: red; }
21 .done { font-family: monospace; color: green; }
22 .priority { font-family: monospace; color: orange; }
23 .tag { background-color: #eee; font-family: monospace;
24 padding: 2px; font-size: 80%; font-weight: normal; }
25 .timestamp { color: #bebebe; }
26 .timestamp-kwd { color: #5f9ea0; }
27 .org-right { margin-left: auto; margin-right: 0px; text-align: right; }
28 .org-left { margin-left: 0px; margin-right: auto; text-align: left; }
29 .org-center { margin-left: auto; margin-right: auto; text-align: center; }
30 .underline { text-decoration: underline; }
31 #postamble p, #preamble p { font-size: 90%; margin: .2em; }
32 p.verse { margin-left: 3%; }
34 border: 1px solid #e6e6e6;
36 background-color: #f2f2f2;
38 font-family: monospace;
53 background-color: #f2f2f299;
55 pre.src:hover:before { display: inline; margin-top: 14px;}
56 /* Languages per Org manual */
57 pre.src-asymptote:before { content: 'Asymptote'; }
58 pre.src-awk:before { content: 'Awk'; }
59 pre.src-authinfo::before { content: 'Authinfo'; }
60 pre.src-C:before { content: 'C'; }
61 /* pre.src-C++ doesn't work in CSS */
62 pre.src-clojure:before { content: 'Clojure'; }
63 pre.src-css:before { content: 'CSS'; }
64 pre.src-D:before { content: 'D'; }
65 pre.src-ditaa:before { content: 'ditaa'; }
66 pre.src-dot:before { content: 'Graphviz'; }
67 pre.src-calc:before { content: 'Emacs Calc'; }
68 pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
69 pre.src-fortran:before { content: 'Fortran'; }
70 pre.src-gnuplot:before { content: 'gnuplot'; }
71 pre.src-haskell:before { content: 'Haskell'; }
72 pre.src-hledger:before { content: 'hledger'; }
73 pre.src-java:before { content: 'Java'; }
74 pre.src-js:before { content: 'Javascript'; }
75 pre.src-latex:before { content: 'LaTeX'; }
76 pre.src-ledger:before { content: 'Ledger'; }
77 pre.src-lisp:before { content: 'Lisp'; }
78 pre.src-lilypond:before { content: 'Lilypond'; }
79 pre.src-lua:before { content: 'Lua'; }
80 pre.src-matlab:before { content: 'MATLAB'; }
81 pre.src-mscgen:before { content: 'Mscgen'; }
82 pre.src-ocaml:before { content: 'Objective Caml'; }
83 pre.src-octave:before { content: 'Octave'; }
84 pre.src-org:before { content: 'Org mode'; }
85 pre.src-oz:before { content: 'OZ'; }
86 pre.src-plantuml:before { content: 'Plantuml'; }
87 pre.src-processing:before { content: 'Processing.js'; }
88 pre.src-python:before { content: 'Python'; }
89 pre.src-R:before { content: 'R'; }
90 pre.src-ruby:before { content: 'Ruby'; }
91 pre.src-sass:before { content: 'Sass'; }
92 pre.src-scheme:before { content: 'Scheme'; }
93 pre.src-screen:before { content: 'Gnu Screen'; }
94 pre.src-sed:before { content: 'Sed'; }
95 pre.src-sh:before { content: 'shell'; }
96 pre.src-sql:before { content: 'SQL'; }
97 pre.src-sqlite:before { content: 'SQLite'; }
98 /* additional languages in org.el's org-babel-load-languages alist */
99 pre.src-forth:before { content: 'Forth'; }
100 pre.src-io:before { content: 'IO'; }
101 pre.src-J:before { content: 'J'; }
102 pre.src-makefile:before { content: 'Makefile'; }
103 pre.src-maxima:before { content: 'Maxima'; }
104 pre.src-perl:before { content: 'Perl'; }
105 pre.src-picolisp:before { content: 'Pico Lisp'; }
106 pre.src-scala:before { content: 'Scala'; }
107 pre.src-shell:before { content: 'Shell Script'; }
108 pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
109 /* additional language identifiers per "defun org-babel-execute"
111 pre.src-cpp:before { content: 'C++'; }
112 pre.src-abc:before { content: 'ABC'; }
113 pre.src-coq:before { content: 'Coq'; }
114 pre.src-groovy:before { content: 'Groovy'; }
115 /* additional language identifiers from org-babel-shell-names in
116 ob-shell.el: ob-shell is the only babel language using a lambda to put
117 the execution function name together. */
118 pre.src-bash:before { content: 'bash'; }
119 pre.src-csh:before { content: 'csh'; }
120 pre.src-ash:before { content: 'ash'; }
121 pre.src-dash:before { content: 'dash'; }
122 pre.src-ksh:before { content: 'ksh'; }
123 pre.src-mksh:before { content: 'mksh'; }
124 pre.src-posh:before { content: 'posh'; }
125 /* Additional Emacs modes also supported by the LaTeX listings package */
126 pre.src-ada:before { content: 'Ada'; }
127 pre.src-asm:before { content: 'Assembler'; }
128 pre.src-caml:before { content: 'Caml'; }
129 pre.src-delphi:before { content: 'Delphi'; }
130 pre.src-html:before { content: 'HTML'; }
131 pre.src-idl:before { content: 'IDL'; }
132 pre.src-mercury:before { content: 'Mercury'; }
133 pre.src-metapost:before { content: 'MetaPost'; }
134 pre.src-modula-2:before { content: 'Modula-2'; }
135 pre.src-pascal:before { content: 'Pascal'; }
136 pre.src-ps:before { content: 'PostScript'; }
137 pre.src-prolog:before { content: 'Prolog'; }
138 pre.src-simula:before { content: 'Simula'; }
139 pre.src-tcl:before { content: 'tcl'; }
140 pre.src-tex:before { content: 'TeX'; }
141 pre.src-plain-tex:before { content: 'Plain TeX'; }
142 pre.src-verilog:before { content: 'Verilog'; }
143 pre.src-vhdl:before { content: 'VHDL'; }
144 pre.src-xml:before { content: 'XML'; }
145 pre.src-nxml:before { content: 'XML'; }
146 /* add a generic configuration mode; LaTeX export needs an additional
147 (add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
148 pre.src-conf:before { content: 'Configuration File'; }
150 table { border-collapse:collapse; }
151 caption.t-above { caption-side: top; }
152 caption.t-bottom { caption-side: bottom; }
153 td, th { vertical-align:top; }
154 th.org-right { text-align: center; }
155 th.org-left { text-align: center; }
156 th.org-center { text-align: center; }
157 td.org-right { text-align: right; }
158 td.org-left { text-align: left; }
159 td.org-center { text-align: center; }
160 dt { font-weight: bold; }
161 .footpara { display: inline; }
162 .footdef { margin-bottom: 1em; }
163 .figure { padding: 1em; }
164 .figure p { text-align: center; }
165 .equation-container {
171 vertical-align: middle;
176 vertical-align: middle;
180 border: 2px solid gray;
185 { text-align: right; font-size: 70%; white-space: nowrap; }
186 textarea { overflow-x: auto; }
187 .linenr { font-size: smaller }
188 .code-highlighted { background-color: #ffff00; }
189 .org-info-js_info-navigation { border-style: none; }
190 #org-info-js_console-label
191 { font-size: 10px; font-weight: bold; white-space: nowrap; }
192 .org-info-js_search-highlight
193 { background-color: #ffff00; color: #000000; font-weight: bold; }
196 <link rel="stylesheet" type="text/css" href="https://thomasf.github.io/solarized-css/solarized-dark.min.css" />
199 <div id="content" class="content">
200 <h1 class="title">CLI Helper - library to help implementing commandline interfaces</h1>
201 <div id="table-of-contents" role="doc-toc">
202 <h2>Table of Contents</h2>
203 <div id="text-table-of-contents" role="doc-toc">
205 <li><a href="#org427daf2">1. General</a>
207 <li><a href="#orgaf34b18">1.1. Source code</a></li>
210 <li><a href="#org2d2e85d">2. Overview</a>
212 <li><a href="#org81434cb">2.1. Ask for user input</a></li>
215 <li><a href="#orgcd70162">3. Getting the library</a></li>
216 <li><a href="#org7b73615">4. TODO:</a></li>
221 <div id="outline-container-org427daf2" class="outline-2">
222 <h2 id="org427daf2"><span class="section-number-2">1.</span> General</h2>
223 <div class="outline-text-2" id="text-1">
225 <li>This program is free software: released under Creative Commons Zero
230 <li>Svjatoslav Agejenko</li>
231 <li>Homepage: <a href="https://svjatoslav.eu">https://svjatoslav.eu</a></li>
232 <li>Email: <a href="mailto://svjatoslav@svjatoslav.eu">mailto://svjatoslav@svjatoslav.eu</a></li>
235 <li><a href="https://www.svjatoslav.eu/projects/">Other software projects hosted at svjatoslav.eu</a></li>
239 <div id="outline-container-orgaf34b18" class="outline-3">
240 <h3 id="orgaf34b18"><span class="section-number-3">1.1.</span> Source code</h3>
241 <div class="outline-text-3" id="text-1-1">
243 <li><a href="https://www2.svjatoslav.eu/gitweb/?p=cli-helper.git;a=snapshot;h=HEAD;sf=tgz">Download latest snapshot in TAR GZ format</a></li>
245 <li><a href="https://www2.svjatoslav.eu/gitweb/?p=cli-helper.git;a=summary">Browse Git repository online</a></li>
248 Clone Git repository using command:
250 <pre class="example">
251 git clone https://www2.svjatoslav.eu/git/cli-helper.git
254 <li>See <a href="https://www3.svjatoslav.eu/projects/cli-helper/apidocs/">JavaDoc</a></li>
260 <div id="outline-container-org2d2e85d" class="outline-2">
261 <h2 id="org2d2e85d"><span class="section-number-2">2.</span> Overview</h2>
262 <div class="outline-text-2" id="text-2">
264 <li>See also: <a href="https://www3.svjatoslav.eu/projects/cli-helper/apidocs/">CLI Helper JavaDoc</a></li>
268 This is library intended to facilitate creation of commandline
269 applications in Java programming language. Library is packaged as an
270 artifact to Maven repository. This makes it simple to add library as
271 dependency to your project.
275 Library provides following general functionalities:
278 <li><a href="#org81434cb">Asking for user input</a></li>
279 <li><a href="CLI arguments processing.html#ID-46115263-ed3d-4acc-9ec5-523d7acf87b8">Commandline arguments processing</a></li>
283 <div id="outline-container-org81434cb" class="outline-3">
284 <h3 id="org81434cb"><span class="section-number-3">2.1.</span> Ask for user input</h3>
285 <div class="outline-text-3" id="text-2-1">
287 <dt>askBoolean()</dt><dd>Asks the user to enter a boolean value (yes/no).</dd>
288 <dt>askLong()</dt><dd>Asks the user to enter an integer.</dd>
289 <dt>askString()</dt><dd>Asks the user to enter a string.</dd>
295 <div id="outline-container-orgcd70162" class="outline-2">
296 <h2 id="orgcd70162"><span class="section-number-2">3.</span> Getting the library</h2>
297 <div class="outline-text-2" id="text-3">
299 Instructions to embed svjatoslav-commons library in your project:
303 Maven pom.xml file snippet:
306 <div class="org-src-container">
307 <pre class="src src-xml"><<span style="color: #89b4fa;">dependencies</span>>
309 <<span style="color: #89b4fa;">dependency</span>>
310 <<span style="color: #89b4fa;">groupId</span>>eu.svjatoslav</<span style="color: #89b4fa;">groupId</span>>
311 <<span style="color: #89b4fa;">artifactId</span>>cli-helper</<span style="color: #89b4fa;">artifactId</span>>
312 <<span style="color: #89b4fa;">version</span>>1.1</<span style="color: #89b4fa;">version</span>>
313 </<span style="color: #89b4fa;">dependency</span>>
315 </<span style="color: #89b4fa;">dependencies</span>>
318 <<span style="color: #89b4fa;">repositories</span>>
320 <<span style="color: #89b4fa;">repository</span>>
321 <<span style="color: #89b4fa;">id</span>>svjatoslav.eu</<span style="color: #89b4fa;">id</span>>
322 <<span style="color: #89b4fa;">name</span>>Svjatoslav repository</<span style="color: #89b4fa;">name</span>>
323 <<span style="color: #89b4fa;">url</span>>http://www3.svjatoslav.eu/maven/</<span style="color: #89b4fa;">url</span>>
324 </<span style="color: #89b4fa;">repository</span>>
326 </<span style="color: #89b4fa;">repositories</span>>
331 <div id="outline-container-org7b73615" class="outline-2">
332 <h2 id="org7b73615"><span class="section-number-2">4.</span> TODO:</h2>
333 <div class="outline-text-2" id="text-4">
335 List of improvement suggestions:
339 <li>Add more concrete examples of how to use the library in JavaDoc
340 comments. This will help developers quickly get started and learn
343 <li>Provide more comprehensive unit tests for CliHelper,
344 ParameterParser, Options and subclasses. This will ensure robustness
347 <li>Add JavaDoc comments to all classes and methods where
348 applicable. This will provide better visibility into the library's
349 functionality for developers.</li>
351 <li>Add more option types like date/time, regular expression etc.</li>
353 <li>Document best practices for using the library in a larger project.</li>
355 <li>Implement support for more complex CLI applications like option
356 dependencies and conflicts resolution.</li>
361 <div id="postamble" class="status">
362 <p class="author">Author: Svjatoslav Agejenko</p>
363 <p class="date">Created: 2023-10-29 Sun 23:27</p>
364 <p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>