Skip to content

Commit 3bf8593

Browse files
committed
[feat] cli: add version parameter
1 parent 42f7592 commit 3bf8593

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/fasttrack-cli.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,15 @@ void loadConfig(QString path, QMap<QString, QString> &parameters) {
4343
}
4444

4545
void help() {
46-
printf(("Usage: [OPTION]... [FILE]...\n"));
46+
printf("Usage: [OPTION]... [FILE]...\n");
4747
fputs(("\
48-
Use FastTrack from the command line.\n\
48+
Use FastTrack version \
49+
"),
50+
stdout);
51+
fputs((APP_VERSION),
52+
stdout);
53+
fputs(("\
54+
from the command line.\n\
4955
\n\
5056
"),
5157
stdout);
@@ -119,6 +125,7 @@ int main(int argc, char **argv) {
119125
{"backPath", required_argument, 0, 'w'},
120126
{"cfg", required_argument, 0, 'A'},
121127
{"help", no_argument, 0, 'x'},
128+
{"version", no_argument, 0, 'V'},
122129
{0, 0, 0, 0}};
123130

124131
int option_index = 0;
@@ -134,6 +141,12 @@ int main(int argc, char **argv) {
134141
loadConfig(QString::fromStdString(optarg), parameters);
135142
break;
136143
}
144+
else if (c == 'V') {
145+
printf("FastTrack ");
146+
printf(APP_VERSION);
147+
printf("\nLicense GPLv3+: GNU GPL version 3\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\nWritten by Benjamin Gallois\n");
148+
return 0;
149+
}
137150
else if (c == 'x') {
138151
help();
139152
return 0;

0 commit comments

Comments
 (0)