OsBound

expect object OsBound(source)

Platform abstraction layer providing OS-specific functionality.

This expect object is implemented differently on each platform (JVM, Native, etc.) to provide access to platform-specific features like environment variables, terminal capabilities, and output handling.

actual object OsBound
actual object OsBound

Properties

Link copied to clipboard
expect val termNewLine: String

The platform-specific newline character sequence.

actual val termNewLine: String
actual val termNewLine: String

Functions

Link copied to clipboard
expect fun eflush()

Flushes the error stream.

actual fun eflush()
actual fun eflush()
Link copied to clipboard
expect fun eprint(message: Any?)

Prints a message to standard error without a trailing newline.

actual fun eprint(message: Any?)
actual fun eprint(message: Any?)
Link copied to clipboard
expect fun eprintln(message: Any?)

Prints a message to standard error with a trailing newline.

actual fun eprintln(message: Any?)
actual fun eprintln(message: Any?)
Link copied to clipboard
expect fun exit(exitCode: Int = 0): Nothing

Exits the application with the specified exit code.

actual fun exit(exitCode: Int): Nothing
actual fun exit(exitCode: Int): Nothing
Link copied to clipboard
expect fun flush()

Flushes the output stream.

actual fun flush()
actual fun flush()
Link copied to clipboard
expect fun getenv(name: String): String?

Gets the value of an environment variable.

actual fun getenv(name: String): String?
actual fun getenv(name: String): String?
Link copied to clipboard
expect fun readFile(path: String): String?

Reads the entire contents of a file as a UTF-8 encoded string.

actual fun readFile(path: String): String?
actual fun readFile(path: String): String?
Link copied to clipboard
expect fun readPassword(): CharArray?

Reads a password from the terminal.

actual fun readPassword(): CharArray?
actual fun readPassword(): CharArray?
Link copied to clipboard
expect fun supportsAnsi(): Boolean

Checks if the current terminal supports ANSI color codes.

actual fun supportsAnsi(): Boolean
actual fun supportsAnsi(): Boolean
Link copied to clipboard
expect fun termWidth(): Int

Gets the width of the terminal in columns.

actual fun termWidth(): Int
actual fun termWidth(): Int