Skip to content

Commit 7a7e12f

Browse files
authored
T.scholze/28 config file (#29)
2 parents c5f7ef7 + 0bceea6 commit 7a7e12f

File tree

8 files changed

+164
-219
lines changed

8 files changed

+164
-219
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ Clone the [kotlog-template repository](https://github.com/tscholze/kotlin-kotlog
3333
-g : Generates HTML output
3434
-p : Publish aka pushes changes to remote
3535
-co : Clears the output
36+
-cc : To create a new configuration file
3637
```
3738

3839
## Configuration
3940

41+
### Using configuration instance
4042
A Kotlog-generated blog ist configurated using the `BlogConfiguration` parameter of the `Kotlog` invocation.
4143
See `Main.kt` for a working example:
4244

@@ -54,8 +56,20 @@ fun main(args: Array<String>) {
5456
}
5557
```
5658

59+
### Using configuration file
60+
Otherwise, Kotlog will try to load the configuration file (`~/.kotlog`) from the file system. Run `./kotlog -cc` to create a new file.
61+
62+
```json
63+
{
64+
"baseUrl": "https://tscholze.github.io/blog",
65+
"titleText": "Tobias Scholze | The Stuttering Nerd",
66+
"footerText": "Made with ❤️ without JavaScript| Kotlog | Tobias Scholze",
67+
"outputDirectoryName": "www"
68+
}
69+
```
70+
5771
## How it looks
58-
![](https://github.com/tscholze/kotlin-kotlog-cli/blob/main/docs/kotlog-markdown2html.png?raw=true)
72+
![Flow](https://github.com/tscholze/kotlin-kotlog-cli/blob/main/docs/kotlog-markdown2html.png?raw=true)
5973
(Design, look and feel and other ui elements my differ from version to version)
6074

6175
## Features

__output/2022-09-16-hi-i-m-kotlog-.html

Lines changed: 0 additions & 59 deletions
This file was deleted.

__output/index.html

Lines changed: 0 additions & 120 deletions
This file was deleted.

__output/posts.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

build.gradle.kts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22

3+
// MARK: - Properties -
4+
5+
group = "io.github.tscholze"
6+
version = "1.0.5"
7+
8+
// MARK: - Plugins -
9+
310
plugins {
411
kotlin("jvm") version "1.7.10"
512
kotlin("plugin.serialization") version "1.7.10"
613
application
714
}
815

9-
group = "io.github.tscholze"
10-
version = "1.0.5"
16+
// MARK: - Repositories -
1117

1218
repositories {
1319
mavenCentral()
1420
}
1521

22+
// MARK: - Dependencies -
23+
1624
dependencies {
1725
// Markdown
1826
implementation("org.commonmark:commonmark:0.19.0")
@@ -34,6 +42,14 @@ dependencies {
3442
testImplementation(kotlin("test"))
3543
}
3644

45+
// MARK: - Application settings -
46+
47+
application {
48+
mainClass.set("MainKt")
49+
}
50+
51+
// MARK: - Gradle tasks -
52+
3753
tasks.jar {
3854
manifest {
3955
attributes["Main-Class"] = "MainKt"
@@ -50,8 +66,4 @@ tasks.test {
5066

5167
tasks.withType<KotlinCompile> {
5268
kotlinOptions.jvmTarget = "1.8"
53-
}
54-
55-
application {
56-
mainClass.set("MainKt")
5769
}

src/main/kotlin/Main.kt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import io.github.tscholze.kotlog.Kotlog
2-
import io.github.tscholze.kotlog.models.BlogConfiguration
32

43
fun main(args: Array<String>) {
54

6-
// 1. Create a configuration for the blog
7-
val configuration = BlogConfiguration(
8-
baseUrl = "https://tscholze.github.io/blog",
9-
titleText = "Tobias Scholze | The Stuttering Nerd",
10-
footerText = "Made with ❤️ without JavaScript| Kotlog | Tobias Scholze",
11-
outputDirectoryName = "www"
12-
)
5+
// 1. Create a configuration for the blog,
6+
// or it will be fetched from `~/.kotlog file`
7+
//
8+
// Sample:
9+
10+
// val configuration = BlogConfiguration(
11+
// baseUrl = "https://tscholze.github.io/blog",
12+
// titleText = "Tobias Scholze | The Stuttering Nerd",
13+
// footerText = "Made with ❤️ without JavaScript| Kotlog | Tobias Scholze",
14+
// outputDirectoryName = "www"
15+
//)
1316

1417
// 2. Call and run Kotlog with command line arguments and configuration.
15-
Kotlog(args, configuration)
18+
Kotlog(args)
1619
}
1720

0 commit comments

Comments
 (0)