File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
src/main/java/pl/koder95/cmf Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 44
44
<artifactId >gson</artifactId >
45
45
<version >2.11.0</version >
46
46
</dependency >
47
+ <dependency >
48
+ <groupId >commons-cli</groupId >
49
+ <artifactId >commons-cli</artifactId >
50
+ <version >1.9.0</version >
51
+ </dependency >
47
52
</dependencies >
48
53
49
54
<licenses >
Original file line number Diff line number Diff line change 1
1
package pl .koder95 .cmf ;
2
2
3
+ import org .apache .commons .cli .*;
4
+
3
5
import java .util .Arrays ;
4
6
5
7
public class Main {
@@ -8,5 +10,18 @@ public static void main(String[] args) {
8
10
System .out .println ("Catholic Moveable Feasts by Kamil Jan Mularski [Koder95]. See more: https://koder95.pl/" );
9
11
System .out .println ("— It is starting with arguments: " + Arrays .deepToString (args ));
10
12
System .out .println ();
13
+
14
+ Options options = new Options ();
15
+ options .addOption ("h" , "help" , false , "wyświetla pomoc programu" );
16
+ CommandLineParser parser = new DefaultParser (false );
17
+ try {
18
+ CommandLine cl = parser .parse (options , args );
19
+ if (cl .hasOption ("h" )) {
20
+ HelpFormatter hf = new HelpFormatter ();
21
+ hf .printHelp ("cmf" , options );
22
+ }
23
+ } catch (ParseException e ) {
24
+ throw new RuntimeException (e );
25
+ }
11
26
}
12
27
}
You can’t perform that action at this time.
0 commit comments