Skip to content

Commit 87b8583

Browse files
committed
Update documentation
* Generate dokka * Update mkdocs version * Group adjacent code blocks into tabs * Switch api docs to gfm format
1 parent b820559 commit 87b8583

File tree

805 files changed

+6939
-12952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

805 files changed

+6939
-12952
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
### Changed
1212
- If multiple `--` tokens are present on the command line, all subsequent occurrences after the first are now parsed as positional arguments. Previously, subsequent `--` tokens were skipped.
1313
- The `PlaintextHelpFormatter` has been replaced with `CliktHelpFormatter`, which is more customizable. See [the docs](https://ajalt.github.io/clikt/documenting/) for more info, or the [new sample](samples/ansicolors/README.md) for an example of customizing help output to use ANSI colors.
14-
- Some of the properties and constructor parameters for [`OptionWithValues`](https://ajalt.github.io/clikt/api/clikt/com.github.ajalt.clikt.parameters.options/-option-with-values/index.html) and [`ProcessedArgument`](https://ajalt.github.io/clikt/api/clikt/com.github.ajalt.clikt.parameters.arguments/-processed-argument/index.html) have changed.
14+
- Some of the properties and constructor parameters for [`OptionWithValues`](https://ajalt.github.io/clikt/api/clikt/com.github.ajalt.clikt.parameters.options/-option-with-values/) and [`ProcessedArgument`](https://ajalt.github.io/clikt/api/clikt/com.github.ajalt.clikt.parameters.arguments/-processed-argument/) have changed.
1515
- The `OptionDelegate` interface has changed, and `GroupableOption` and `ParameterHolder` interfaces have been added to work with option groups.
1616
- [Parameter validation](https://ajalt.github.io/clikt/parameters/#parameter-validation) now occurs after all parameter delegates have set their values, so the lambdas passed to `validate` may reference other parameters.
1717

build.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ buildscript {
88

99
dependencies {
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.17"
11+
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.18"
1212
}
1313
}
1414

1515
apply plugin: 'idea'
1616
apply plugin: 'org.jetbrains.dokka'
1717

18+
repositories {
19+
mavenCentral()
20+
jcenter()
21+
}
22+
1823
subprojects {
1924
apply plugin: 'kotlin'
2025

clikt/build.gradle

100755100644
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ artifacts {
3737

3838
dokka {
3939
outputDirectory = "$rootDir/docs/api"
40+
outputFormat = 'gfm'
4041
}
4142

4243
ext {

clikt/src/main/kotlin/com/github/ajalt/clikt/core/exceptions.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import com.github.ajalt.clikt.parameters.arguments.Argument
44
import com.github.ajalt.clikt.parameters.arguments.convert
55
import com.github.ajalt.clikt.parameters.groups.ParameterGroup
66
import com.github.ajalt.clikt.parameters.options.Option
7+
import kotlin.math.exp
78

89
/**
910
* An internal error that signals Clikt to abort.

docs/advanced.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ like the way you can configure git to accept `git ci` as an alias for
1212
`git commit`.
1313

1414
To implement command aliases, override
15-
[`CliktCommand.aliases`](api/clikt/com.github.ajalt.clikt.core/-clikt-command/aliases.html) in your
15+
[`CliktCommand.aliases`](/api/clikt/com.github.ajalt.clikt.core/-clikt-command/aliases/) in your
1616
command. This function is called once at the start of parsing, and returns a map of aliases to the
1717
tokens that they alias to.
1818

1919
To implement git-style aliases:
2020

21-
```kotlin
21+
```kotlin tab="Example"
2222
class Repo : NoRunCliktCommand() {
2323
// You could load the aliases from a config file etc.
2424
override fun aliases(): Map<String, List<String>> = mapOf(
@@ -37,14 +37,12 @@ class Commit: CliktCommand() {
3737
fun main(args: Array<String>) = Repo().subcommands(Commit()).main(args)
3838
```
3939

40-
And on the command line:
41-
42-
```
40+
```text tab="Usage 1"
4341
$ ./repo ci -m 'my message'
4442
Committing with message: my message
4543
```
4644

47-
```
45+
```text tab="Usage 2"
4846
$ ./repo cm 'my message'
4947
Committing with message: my message
5048
```
@@ -100,12 +98,12 @@ Running Bar
10098

10199
To prevent ambiguities in parsing, aliases are only supported for
102100
command names. However, there's another way to modify user input that
103-
works on more types of tokens. You can set a [`tokenTransformer`](api/clikt/com.github.ajalt.clikt.core/-context/token-transformer.html) on the
101+
works on more types of tokens. You can set a [`tokenTransformer`](/api/clikt/com.github.ajalt.clikt.core/-context/token-transformer/) on the
104102
[command's context](commands.md#customizing-contexts) that will be
105103
called for each option and command name that is input. This can be used
106104
to implement case-insensitive parsing, for example:
107105

108-
```kotlin
106+
```kotlin tab="Example"
109107
class Hello : CliktCommand() {
110108
init {
111109
context { tokenTransformer = { it.toLowerCase() } }
@@ -116,18 +114,18 @@ class Hello : CliktCommand() {
116114
}
117115
```
118116

119-
```
117+
```text tab="Usage"
120118
$ ./hello --NAME=Foo
121119
Hello Foo!
122120
```
123121

124122
## Replacing stdin and stdout
125123

126-
By default, functions like [`CliktCommand.main`](api/clikt/com.github.ajalt.clikt.core/-clikt-command/main.html)
127-
and [`option().prompt()`](api/clikt/com.github.ajalt.clikt.parameters.options/prompt.html)
124+
By default, functions like [`CliktCommand.main`](/api/clikt/com.github.ajalt.clikt.core/-clikt-command/main/)
125+
and [`option().prompt()`](/api/clikt/com.github.ajalt.clikt.parameters.options/prompt/)
128126
read from `System.in` and write to `System.out`. If you want to use
129127
clikt in an environment where the standard streams aren't available, you
130-
can set your own implementation of [`CliktConsole`](api/clikt/com.github.ajalt.clikt.output/-clikt-console/index.html)
128+
can set your own implementation of [`CliktConsole`](/api/clikt/com.github.ajalt.clikt.output/-clikt-console/)
131129
when [customizing the command context](commands.md#customizing-contexts).
132130

133131
```kotlin
@@ -153,7 +151,7 @@ class CustomCLI : CliktCommand() {
153151
```
154152

155153
If you are using
156-
[`TermUI`](api/clikt/com.github.ajalt.clikt.output/-term-ui/index.html)
154+
[`TermUI`](/api/clikt/com.github.ajalt.clikt.output/-term-ui/)
157155
directly, you can also pass your custom console as an argument.
158156

159157
## Command Line Argument Files

0 commit comments

Comments
 (0)