1 module dsemver.options;
2 
3 import std.typecons : Nullable, nullable, Tuple, tuple;
4 import args;
5 
6 struct Options {
7 	//@Arg('p', Optional.no,
8 	@Arg('p', "The path to the project the SemVer should be calculated for")
9 	string projectPath;
10 
11 	@Arg('o')
12 	string old;
13 
14 	@Arg('n')
15 	string neu;
16 
17 	@Arg('t')
18 	string testParse;
19 
20 	@Arg('l', "Compute the interface of the latest git tag as reference")
21 	bool buildLastestTag;
22 
23 	@Arg('c', "Compute the next version number")
24 	bool buildNextSemVer;
25 
26 	@Arg('v', "Enable verbose output")
27 	bool verbose;
28 }
29 
30 ref const(Options) getOptions() {
31 	return getWritableOptions();
32 }
33 
34 ref Options getWritableOptions() {
35 	static Options ret;
36 	return ret;
37 }
38 
39 void getOptOptions(ref string[] args) {
40 	import core.stdc.stdlib : exit;
41 	const len = args.length;
42 	bool helpWanted = parseArgsWithConfigFile(getWritableOptions(), args);
43 	if(helpWanted || len == 1) {
44 		printArgsHelp(getOptions(),
45 `
46 
47 dsemver lets the computer compute the SemVer of your dlang software.
48 
49 If this is the first time running dsemver on your project you like want to
50 run
51 
52 '''
53 $ ./dsemver -- -p PATH_TO_PROJECT -l
54 '''
55 
56 To compute the public interface of your latest git tag that looked it a SemVer
57 than you can run
58 
59 '''
60 $ ./dsemver -- -p PATH_TO_PROJECT -c
61 '''
62 
63 To compute the next SemVer of your project.`);
64 		exit(0);
65 	}
66 }