object Shell


Allows to execute commands. This class builds on top of ShellProcess and abstracts the shell streams to focus on the output of a single command execution. A ShellProcess is created for each executed command, using a ShellServer that can be reset by Shell.setShellServer.

Summary

Nested types

The output of a shell command executed via Shell.command.

Public functions

ApplicationCommands
application(packageName: String)

Commands for application.

Shell.CommandOutput
command(command: String)

Executes a given command and returns the ongoing CommandOutput.

PermissionCommands
permission(packageName: String)

Commands for permissions.

ProcessCommands

Commands for processes.

RecorderCommands

Commands for screen recorder.

ScreenCommands

Commands for screen.

Unit

Allows configuring the underlying ShellProcess utilized to execute the commands.

WifiCommands

Commands for wifi.

Public functions

application

Added in 1.0.0-alpha02
fun application(packageName: String): ApplicationCommands

Commands for application.

Parameters
packageName: String

the application package name

Returns
ApplicationCommands

an instance of ApplicationCommands.

command

Added in 1.0.0-alpha02
fun command(command: String): Shell.CommandOutput

Executes a given command and returns the ongoing CommandOutput.

Parameters
command: String

a string containing the command to launch.

Returns
Shell.CommandOutput

a CommandOutput that allows to access the stream of the command output.

permission

Added in 1.0.0-alpha02
fun permission(packageName: String): PermissionCommands

Commands for permissions.

Parameters
packageName: String

the application package name

Returns
PermissionCommands

an instance of PermissionCommands.

process

Added in 1.0.0-alpha02
fun process(): ProcessCommands

Commands for processes.

Returns
ProcessCommands

an instance of ProcessCommands.

recorder

Added in 1.0.0-alpha02
fun recorder(): RecorderCommands

Commands for screen recorder.

Returns
RecorderCommands

an instance of RecorderCommands.

screen

Added in 1.0.0-alpha02
fun screen(): ScreenCommands

Commands for screen.

setShellServer

Added in 1.0.0-alpha02
fun setShellServer(shellServer: ShellServer): Unit

Allows configuring the underlying ShellProcess utilized to execute the commands. The current ShellServer backing Shell is always closed when setting a new one.

Parameters
shellServer: ShellServer

The new shell server to produce ShellProcess to launch commands.

wifi

Added in 1.0.0-alpha02
fun wifi(): WifiCommands

Commands for wifi.

Returns
WifiCommands

an instance of WifiCommands.