-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from kleis-technology/feature/cli
Feature/cli
- Loading branch information
Showing
18 changed files
with
4,820 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
export GIT_ROOT=$(git rev-parse --show-toplevel) | ||
function lcaac() { | ||
$GIT_ROOT/cli/build/install/cli/bin/cli $@ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# LCAAC Command-Line Interface | ||
|
||
## Set-up | ||
|
||
```bash | ||
./gradlew :cli:installDist | ||
alias lcaac=$GIT_ROOT/cli/build/install/cli/bin/cli | ||
``` | ||
|
||
## Impact assessment | ||
|
||
The `assess` command runs the impact assessment of a target process. | ||
The results are printed on the standard output in CSV format. | ||
|
||
```bash | ||
cd $GIT_ROOT/cli/samples | ||
lcaac assess "electricity_mix" | ||
``` | ||
|
||
```bash | ||
cd $GIT_ROOT/cli/samples | ||
lcaac assess "electricity_mix" --data params.csv | ||
``` | ||
|
||
## Help | ||
|
||
```bash | ||
lcaac --help | ||
lcaac assess --help | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
fun properties(key: String) = project.findProperty(key).toString() | ||
|
||
plugins { | ||
application | ||
`maven-publish` | ||
id("org.jetbrains.kotlin.jvm") | ||
} | ||
|
||
val groupId = properties("lcaacGroup") | ||
val artifactId = "cli" | ||
val artifactVersion = properties("lcaacVersion") | ||
val javaVersion = properties("javaVersion") | ||
|
||
application { | ||
mainClass.set("ch.kleis.lcaac.cli.MainKt") | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(Integer.parseInt(javaVersion)) | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation(project(":core")) | ||
testImplementation(project(":core")) | ||
|
||
implementation(project(":grammar")) | ||
testImplementation(project(":grammar")) | ||
|
||
testImplementation("io.mockk:mockk:1.13.4") | ||
implementation(kotlin("stdlib-jdk8")) | ||
|
||
val log4jVersion = "2.20.0" | ||
implementation("org.apache.logging.log4j:log4j-api:$log4jVersion") | ||
implementation("org.apache.logging.log4j:log4j-core:$log4jVersion") | ||
implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion") | ||
|
||
testImplementation(kotlin("test")) | ||
|
||
implementation("com.github.ajalt.clikt:clikt:4.2.2") | ||
implementation("org.apache.commons:commons-csv:1.10.0") | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/kleis-technology/lcaac") | ||
credentials { | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
publications { | ||
create<MavenPublication>("cli") { | ||
groupId = groupId | ||
artifactId = artifactId | ||
version = artifactVersion | ||
from(components["java"]) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
process electricity_mix { | ||
params { | ||
from_fossil = 40 percent | ||
from_nuclear = 20 percent | ||
from_hydro = 40 percent | ||
} | ||
products { | ||
1 kWh electricity | ||
} | ||
inputs { | ||
from_fossil * 1 kWh electricity from fossil | ||
from_nuclear * 1 kWh electricity from nuclear | ||
from_hydro * 1 kWh electricity from hydro | ||
} | ||
} | ||
|
||
process fossil { | ||
products { | ||
1 kWh electricity | ||
} | ||
impacts { | ||
10 kg co2 | ||
} | ||
} | ||
|
||
process nuclear { | ||
products { | ||
1 kWh electricity | ||
} | ||
impacts { | ||
5 kg co2 | ||
} | ||
} | ||
|
||
process hydro { | ||
products { | ||
1 kWh electricity | ||
} | ||
impacts { | ||
1 kg co2 | ||
} | ||
} |
Oops, something went wrong.