Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Commit 8142b9f

Browse files
authored
feat(flag): Add version flag (#3)
* feat(flag): Add version flag
1 parent 3b7f032 commit 8142b9f

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

.github/workflows/conda-build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121

2222
steps:
2323
- uses: actions/checkout@v2
24+
with:
25+
fetch-depth: 0
2426

2527
- uses: conda-incubator/setup-miniconda@v2
2628
with:

.github/workflows/main.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ jobs:
3737
- name: build using cmake
3838
run: make cmake-build
3939

40+
- name: test flags
41+
run: |
42+
bin/arx --version
43+
4044
- name: lint
4145
run: |
4246
pre-commit install

.releaserc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@
2020
}
2121
],
2222
"countMatches": true
23+
},
24+
{
25+
"files": ["arx/src/arx.cpp"],
26+
"from": "std::string ARX_VERSION = \".*\"; // semantic-release",
27+
"to": "std::string ARX_VERSION = \"${nextRelease.version}\"; // semantic-release",
28+
"results": [
29+
{
30+
"file": "arx/src/arx.cpp",
31+
"hasChanged": true,
32+
"numMatches": 1,
33+
"numReplacements": 1
34+
}
35+
],
36+
"countMatches": true
2337
}
2438
]
2539
}

arx/src/arx.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include <cctype>
1616
#include <cstdio>
17+
#include <iostream>
1718
#include <map>
1819
#include <string>
1920
#include <vector>
@@ -30,8 +31,7 @@
3031
#include "llvm/Support/TargetSelect.h"
3132
#include "llvm/Transforms/Scalar.h"
3233

33-
// using namespace llvm;
34-
// using namespace llvm::orc;
34+
std::string ARX_VERSION = "1.0.0"; // semantic-release
3535

3636
//===----------------------------------------------------------------------===//
3737
// Lexer
@@ -1433,7 +1433,14 @@ extern "C" DLLEXPORT double printd(double X) {
14331433
// Main driver code.
14341434
//===----------------------------------------------------------------------===//
14351435

1436-
int main() {
1436+
int main(int argc, const char* argv[]) {
1437+
for (int i = 0; i < argc; ++i) {
1438+
if (std::string(argv[i]) == "--version") {
1439+
std::cout << "arx version: " << ARX_VERSION << std::endl;
1440+
return 0;
1441+
}
1442+
}
1443+
14371444
llvm::InitializeNativeTarget();
14381445
llvm::InitializeNativeTargetAsmPrinter();
14391446
llvm::InitializeNativeTargetAsmParser();

0 commit comments

Comments
 (0)