ensoft/entrance/1.0.5

EnTrance.Feature.Target.CLI

Good ol' CLI prompt interactions. Minimal example:

import EnTrance.Channel as Channel
import EnTrance.Feature.Dynamic exposing (MaybeSubscribe(..))
import EnTrance.Feature.Target as Target
import EnTrance.Feature.Target.CLI as CLI


CLI.start SubscribeToConState
    |> Channel.send model


Target.connect params
    |> Channel.send model


--
-- Back in your update function, after you get a notification saying
-- the connection state is `Connected`:
--
CLI.exec "show version"
    |> Channel.sendSimpleRpc model

Once the CLI command is executed, your update function will get a notification you decode using decode.

exec : String -> Request

Send a CLI command, and get back the result.

decodeExec : (RpcData String -> msg) -> Decoder msg

Decode the reply notification to an exec request. Takes a message constructor.

Starting and stopping

Start a CLI feature instance. This represents the option to connect to one router. This is an async request - use the connection state notifications to track progress.

Stop a CLI feature instance. This is an async request.

decodeIsUp : (Bool -> msg) -> Decoder msg

Decode an up/down notification requested by passing SubscribeToConState to start. Takes a message constructor.