ensoft / entrance / 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 -> EnTrance.Request.Request

Send a CLI command, and get back the result.

decodeExec : (EnTrance.Types.RpcData String -> msg) -> Json.Decode.Decoder msg

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

Starting and stopping

start : EnTrance.Types.MaybeSubscribe -> EnTrance.Request.Request

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 : EnTrance.Request.Request

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

decodeIsUp : (Basics.Bool -> msg) -> Json.Decode.Decoder msg

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