nerves_runtime v0.5.0 Nerves.Runtime.Helpers

Helper functions for making the IEx prompt a little friendlier to use with Nerves. It is intended to be imported to minimize typing:

iex> use Nerves.Runtime.Helpers

For development, you may want to run

iex> Nerves.Runtime.Helpers.install

on the target so that the helpers get automatically imported on each boot.

Helpers include:

  • cmd/1 - runs a shell command and prints the output
  • hex/1 - inspects a value with integers printed as hex
  • reboot/0 - reboots gracefully
  • reboot!/0 - reboots immediately

Help for all of these can be found by running:

iex> h(Nerves.Runtime.Helpers.cmd/1)

Link to this section Summary

Functions

Run a command using :os.cmd/1 and run its output through IO.puts so that newlines get printed nicely

Inspect a value with all integers printed out in hex. This is useful for one-off hex conversions. If you’re doing a lot of work that requires hexadecimal output, you should consider running

Install the helpers so that they’re autoloaded on subsequent reboots

Shortcut to reboot a board. This is a graceful reboot, so it takes some time before the real reboot

Remote immediately without a graceful shutdown. This is for the impatient

Link to this section Functions

Run a command using :os.cmd/1 and run its output through IO.puts so that newlines get printed nicely.

Inspect a value with all integers printed out in hex. This is useful for one-off hex conversions. If you’re doing a lot of work that requires hexadecimal output, you should consider running:

IEx.configure(inspect: [base: :hex])

The drawback of doing the above is that strings print out as hex binaries.

Install the helpers so that they’re autoloaded on subsequent reboots.

Shortcut to reboot a board. This is a graceful reboot, so it takes some time before the real reboot.

Remote immediately without a graceful shutdown. This is for the impatient.