Skip to content

Commit e650bbe

Browse files
committed
Update docs
1 parent 96f3e90 commit e650bbe

File tree

4 files changed

+80
-25
lines changed

4 files changed

+80
-25
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,17 @@ dependencies {
6464
}
6565
```
6666

67+
There is also a smaller core module available. [See the docs for details](https://ajalt.github.io/clikt/advanced/#core-module).
68+
6769

6870
###### If you're using Maven instead of Gradle, use `<artifactId>clikt-jvm</artifactId>`
6971

7072
#### Multiplatform
7173

72-
Clikt supports the following targets: `jvm`, `mingwX64`, `linuxX64`, `linuxArm64`, `macosX64`, `macosArm64`,
73-
and `js` and `wasmJs` (for both Node.js and Browsers). [See the
74-
docs](https://ajalt.github.io/clikt/advanced/#multiplatform-support) for more information about
75-
functionality supported on each target. You'll need to use Gradle 6 or newer.
74+
Clikt supports most multiplatform targets.
75+
[See the docs](https://ajalt.github.io/clikt/advanced/#multiplatform-support)
76+
for more information about functionality supported on each target. You'll need to use Gradle 6 or
77+
newer.
7678

7779
#### Snapshots
7880

docs/advanced.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -608,35 +608,29 @@ abstract class MyCoreCommand : CoreCliktCommand() {
608608

609609
## Multiplatform Support
610610

611-
Clikt supports the following platforms in addition to JVM:
611+
Clikt supports the following platforms:
612612

613-
### Desktop native (Linux, Windows, and macOS)
614-
615-
All functionality is supported, except:
616-
617-
* `env` parameter of [editText][editText] and [editFile][editFile] is ignored.
618-
* [file][file] and [path][path] parameter types are not supported.
613+
### JVM
619614

620-
### NodeJS JavaScript and WasmJS
615+
There are some JVM-only extensions available such as [file][file] and [path][path] parameter types.
621616

622-
All functionality is supported, except:
623-
624-
* [file][file] and [path][path] parameter types are not supported.
617+
### Desktop native (Linux, Windows, and macOS)
625618

626-
### Browser JavaScript and WasmJS
619+
### JavaScript and WasmJS
627620

628-
All functionality is supported, except:
621+
All functionality is supported on Node.js.
629622

630-
* The default terminal only outputs to the browser's developer console, which is
631-
probably not what you want. You can [define your own
623+
In the browser, the default terminal only outputs to the browser's developer
624+
console, which is probably not what you want. You can [define your own
632625
TerminalInterface](#replacing-stdin-and-stdout), or you can call [parse][parse] instead of
633626
[main][main] and handle output yourself.
634-
* [editText][editText] and [editFile][editFile] are not supported.
635-
* [file][file] and [path][path] parameter types are not supported.
636627

637-
### iOS, watchOS, tvOS and wasmWasi
628+
### iOS
629+
630+
### watchOS, tvOS and WasmWasi
638631

639-
These platforms are supported for the [core module](#core-module) only.
632+
These platforms are not supported by the [markdown module], but all other functionality is
633+
available.
640634

641635
[BaseCliktCommand]: api/clikt/com.github.ajalt.clikt.core/-base-clikt-command/index.html
642636
[CliktCommand]: api/clikt-mordant/com.github.ajalt.clikt.core/-clikt-command/index.html
@@ -662,6 +656,7 @@ These platforms are supported for the [core module](#core-module) only.
662656
[file]: api/clikt/com.github.ajalt.clikt.parameters.types/file.html
663657
[grouping-options]: documenting.md#grouping-options-in-help
664658
[main]: api/clikt/com.github.ajalt.clikt.core/main.html
659+
[markdown module]: documenting.md#markdown-in-help-texts
665660
[parse]: api/clikt/com.github.ajalt.clikt.core/parse.html
666661
[path]: api/clikt/com.github.ajalt.clikt.parameters.types/path.html
667662
[prompt]: options.md#prompting-for-input

docs/migration.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
11
# Upgrading to Newer Releases
22

3+
See the [changelog] for a full list of changes in each release. This guide contains information on
4+
the most significant changes that may require updating to your code.
5+
36
## Upgrading to 5.0
47

5-
## `main` is now an extension
8+
## some methods like `main` are now extensions
69

7-
The `CliktCommand.main` and `CliktCommand.parse` methods are now a extension functions, so you'll
10+
The `CliktCommand.main` and `CliktCommand.parse` methods are now extension functions, so you'll
811
need to import them.
912

1013
```diff
1114
+ import com.github.ajalt.clikt.core.main
1215
fun main(args: Array<String>) = MyCommand().main(args)
1316
```
1417

18+
`Context.obj` and `Context.terminal`, and `OptionTransformContext.terminal` are also now extensions.
19+
20+
```diff
21+
+ import com.github.ajalt.clikt.core.obj
22+
+ import com.github.ajalt.clikt.core.terminal
23+
24+
fun main() {
25+
val ctx = MyCommand().currentContext
26+
ctx.terminal.info(ctx.obj)
27+
}
28+
```
29+
30+
1531
## `CliktCommand` constructor no longer takes most parameters
1632

1733
All parameters of the `CliktCommand` except for `name` have been moved to open properties.
@@ -62,6 +78,44 @@ The full list of moved parameters:
6278
| `treatUnknownOptionsAsArgs` | `val treatUnknownOptionsAsArgs` |
6379
| `hidden` | `val hiddenFromHelp` |
6480

81+
### Markdown moved to a separate module
82+
83+
In order to reduce executable size, the Markdown rendering functionality has been moved to a separate
84+
module.
85+
86+
To use Markdown rendering first, add the `:clitk-markdown` dependency to your project:
87+
88+
```kotlin
89+
dependencies {
90+
implementation("com.github.ajalt.clikt:clikt-markdown:$cliktVersion")
91+
}
92+
```
93+
94+
Then install the markdown help formatter on your command:
95+
96+
```kotlin
97+
val command = MyCommand().installMordantMarkdown()
98+
```
99+
100+
101+
### `Context` builder properties renamed
102+
103+
Some of the properties on `Context` and its builder have been renamed to be more consistent:
104+
105+
| old name | new name |
106+
|-------------------------------|---------------------------------|
107+
| `Context.envvarReader` | `Context.readEnvvar` |
108+
| `Context.correctionSuggestor` | `Context.suggestTypoCorrection` |
109+
| `Context.argumentFileReader` | `Context.readArgumentFile` |
110+
| `Context.tokenTransformer` | `Context.transformToken` |
111+
112+
The old names are still available as deprecated properties.
113+
114+
### Removed `TermUi`
115+
116+
The remaining methods in `TermUi` have been removed. If you were using it, you can open an editor
117+
manually with `ProcessBuilder` or similar.
118+
65119
## Upgrading to 4.0
66120

67121
### Help formatting

docs/quickstart.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ inside a [`CliktCommand`][CliktCommand]. The normal way to use Clikt is to forwa
1212
The simplest command with no parameters would look like this:
1313

1414
```kotlin
15+
import com.github.ajalt.clikt.core.CliktCommand
16+
import com.github.ajalt.clikt.core.main
17+
1518
class Hello: CliktCommand() {
1619
override fun run() {
1720
echo("Hello World!")
@@ -67,6 +70,7 @@ class Hello : SuspendingCliktCommand() {
6770

6871
suspend fun main(args: Array<String>) = Hello().main(args)
6972
```
73+
7074
## Nesting Commands
7175

7276
Instances of any command can be attached to other commands, allowing

0 commit comments

Comments
 (0)