Skip to content

Commit 532a69f

Browse files
koshachyzamulla
andauthored
chore: update command-line.md (#4275)
* chore: update command-line.md * Apply suggestions from code review Co-authored-by: Aleksey Zamulla <[email protected]> --------- Co-authored-by: Aleksey Zamulla <[email protected]>
1 parent 0cc4e14 commit 532a69f

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

docs/topics/command-line.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
Every Kotlin release ships with a standalone version of the compiler. You can download the latest version manually or via a package manager.
44

5-
>Installing the command-line compiler is not an essential step to use Kotlin. A general way to write Kotlin applications is using an
6-
>IDE - [IntelliJ IDEA](https://www.jetbrains.com/idea/) or [Android Studio](https://developer.android.com/studio).
7-
>They provide full Kotlin support out of the box without needing additional components. Learn how to
8-
[get started with Kotlin in an IDE](getting-started.md).
5+
> Installing the command-line compiler is not an essential step to use Kotlin.
6+
> The common approach is to write Kotlin applications using IDEs or code editors with official Kotlin support,
7+
> such as [IntelliJ IDEA](https://www.jetbrains.com/idea/), [JetBrains Fleet](https://www.jetbrains.com/fleet/),
8+
> or [Android Studio](https://developer.android.com/studio).
9+
> They provide full Kotlin support right out of the box, no extra components needed.
10+
>
11+
> Learn how to [get started with Kotlin in an IDE](getting-started.md).
912
>
1013
{type="note"}
1114

@@ -19,7 +22,7 @@ To install the Kotlin compiler manually:
1922
2. Unzip the standalone compiler into a directory and optionally add the `bin` directory to the system path.
2023
The `bin` directory contains the scripts needed to compile and run Kotlin on Windows, macOS, and Linux.
2124

22-
> For Windows users who want to use the command-line compiler, we recommend using the manual installation method.
25+
> If you want to use the Kotlin command-line compiler on Windows, we recommend installing it manually.
2326
>
2427
{type="note"}
2528

@@ -53,8 +56,8 @@ sudo snap install --classic kotlin
5356

5457
## Create and run an application
5558

56-
1. Create a simple application in Kotlin that displays `"Hello, World!"`. In your favorite editor, create a new file called
57-
`hello.kt` with the following lines:
59+
1. Create a simple console JVM application in Kotlin that displays `"Hello, World!"`.
60+
In a code editor, create a new file called `hello.kt` with the following code:
5861

5962
```kotlin
6063
fun main() {
@@ -68,33 +71,33 @@ sudo snap install --classic kotlin
6871
kotlinc hello.kt -include-runtime -d hello.jar
6972
```
7073

71-
The `-d` option indicates the output path for generated class files, which may be either a directory or a *.jar* file.
72-
The `-include-runtime` option makes the resulting *.jar* file self-contained and runnable by including the Kotlin runtime
74+
* The `-d` option indicates the output path for generated class files, which may be either a directory or a **.jar** file.
75+
* The `-include-runtime` option makes the resulting **.jar** file self-contained and runnable by including the Kotlin runtime
7376
library in it.
7477

75-
To see all available options, run
78+
To see all available options, run:
7679

7780
```bash
7881
kotlinc -help
7982
```
8083

81-
3. Run the application.
84+
3. Run the application:
8285

8386
```bash
8487
java -jar hello.jar
8588
```
8689

8790
## Compile a library
8891

89-
If you're developing a library to be used by other Kotlin applications, you can build the *.jar* file without including
90-
the Kotlin runtime in it:
92+
If you're developing a library to be used by other Kotlin applications, you can build the **.jar** file without including
93+
the Kotlin runtime:
9194

9295
```bash
9396
kotlinc hello.kt -d hello.jar
9497
```
9598

96-
Since binaries compiled this way depend on the Kotlin runtime, you should make sure the latter is present in the classpath
97-
whenever your compiled library is used.
99+
Since binaries compiled this way depend on the Kotlin runtime,
100+
you should ensure that it is present in the classpath whenever your compiled library is used
98101

99102
You can also use the `kotlin` script to run binaries produced by the Kotlin compiler:
100103

@@ -113,7 +116,8 @@ and see the results.
113116

114117
## Run scripts
115118

116-
Kotlin can also be used as a scripting language. A script is a Kotlin source file (`.kts`) with top-level executable code.
119+
You can use Kotlin as a scripting language.
120+
A Kotlin script is a Kotlin source file (`.kts`) with top-level executable code.
117121

118122
```kotlin
119123
import java.io.File
@@ -133,9 +137,10 @@ kotlinc -script list_folders.kts -- -d <path_to_folder_to_inspect>
133137
```
134138

135139
Kotlin provides experimental support for script customization, such as adding external properties,
136-
providing static or dynamic dependencies, and so on. Customizations are defined by so-called *Script definitions* -
137-
annotated kotlin classes with the appropriate support code. The script filename extension is used to select the appropriate
138-
definition. Learn more about [Kotlin custom scripting](custom-script-deps-tutorial.md).
140+
providing static or dynamic dependencies, and so on.
141+
Customizations are defined by so-called _script definitions_ – annotated kotlin classes with the appropriate support code.
142+
The script filename extension is used to select the appropriate definition.
143+
Learn more about [Kotlin custom scripting](custom-script-deps-tutorial.md).
139144

140145
Properly prepared script definitions are detected and applied automatically when the appropriate jars are included
141146
in the compilation classpath. Alternatively, you can specify definitions manually by passing the `-script-templates` option
@@ -145,4 +150,4 @@ to the compiler:
145150
kotlinc -script-templates org.example.CustomScriptDefinition -script custom.script1.kts
146151
```
147152

148-
For additional details, please consult the [KEEP-75](https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md).
153+
For additional details, see the [KEEP-75](https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md).

0 commit comments

Comments
 (0)