Fix doctests
This commit is contained in:
parent
3efe38df3e
commit
302ba3eb25
1 changed files with 16 additions and 16 deletions
|
@ -18,28 +18,28 @@ defmodule Freedive.Api.Command do
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> Freedive.execute!("whoami", [], doas: true)
|
iex> Freedive.Api.Command.execute!("whoami", [], doas: true)
|
||||||
"root"
|
"root"
|
||||||
|
|
||||||
iex> Freedive.execute!("whoami", [], doas: "www")
|
iex> Freedive.Api.Command.execute!("whoami", [], doas: "www")
|
||||||
"www"
|
"www"
|
||||||
|
|
||||||
iex> Freedive.execute!("whoami", [], jail: "testjail")
|
iex> Freedive.Api.Command.execute!("whoami", [], jail: "testjail")
|
||||||
"root"
|
"root"
|
||||||
|
|
||||||
iex> Freedive.execute!("whoami", [], jail: "testjail", doas: "operator")
|
iex> Freedive.Api.Command.execute!("whoami", [], jail: "testjail", doas: "operator")
|
||||||
"operator"
|
"operator"
|
||||||
|
|
||||||
iex> Freedive.execute("hostname", [], jail: "testjail")
|
iex> Freedive.Api.Command.execute("hostname", [], jail: "testjail")
|
||||||
{:ok, "testjail"}
|
{:ok, "testjail"}
|
||||||
|
|
||||||
iex> Freedive.execute!("sysctl", ["-n", "security.jail.jailed"])
|
iex> Freedive.Api.Command.execute!("sysctl", ["-n", "security.jail.jailed"])
|
||||||
"0"
|
"0"
|
||||||
|
|
||||||
iex> Freedive.execute!("sysctl", ["-n", "security.jail.jailed"], jail: "testjail")
|
iex> Freedive.Api.Command.execute!("sysctl", ["-n", "security.jail.jailed"], jail: "testjail")
|
||||||
"1"
|
"1"
|
||||||
|
|
||||||
iex> Freedive.execute!("printenv", ["FOO"], jail: "testjail", env: [{"FOO", "bar"}])
|
iex> Freedive.Api.Command.execute!("printenv", ["FOO"], jail: "testjail", env: [{"FOO", "bar"}])
|
||||||
"bar"
|
"bar"
|
||||||
"""
|
"""
|
||||||
def execute!(command, args, opts \\ []), do: raise_on_error(execute(command, args, opts))
|
def execute!(command, args, opts \\ []), do: raise_on_error(execute(command, args, opts))
|
||||||
|
@ -49,28 +49,28 @@ defmodule Freedive.Api.Command do
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> Freedive.execute("whoami", [], doas: true)
|
iex> Freedive.Api.Command.execute("whoami", [], doas: true)
|
||||||
{:ok, "root"}
|
{:ok, "root"}
|
||||||
|
|
||||||
iex> Freedive.execute("whoami", [], doas: "www")
|
iex> Freedive.Api.Command.execute("whoami", [], doas: "www")
|
||||||
{:ok, "www"}
|
{:ok, "www"}
|
||||||
|
|
||||||
iex> Freedive.execute("whoami", [], jail: "testjail")
|
iex> Freedive.Api.Command.execute("whoami", [], jail: "testjail")
|
||||||
{:ok, "root"}
|
{:ok, "root"}
|
||||||
|
|
||||||
iex> Freedive.execute("whoami", [], jail: "testjail", doas: "operator")
|
iex> Freedive.Api.Command.execute("whoami", [], jail: "testjail", doas: "operator")
|
||||||
{:ok, "operator"}
|
{:ok, "operator"}
|
||||||
|
|
||||||
iex> Freedive.execute("hostname", [], jail: "testjail")
|
iex> Freedive.Api.Command.execute("hostname", [], jail: "testjail")
|
||||||
{:ok, "testjail"}
|
{:ok, "testjail"}
|
||||||
|
|
||||||
iex> Freedive.execute("sysctl", ["-n", "security.jail.jailed"])
|
iex> Freedive.Api.Command.execute("sysctl", ["-n", "security.jail.jailed"])
|
||||||
{:ok, "0"}
|
{:ok, "0"}
|
||||||
|
|
||||||
iex> Freedive.execute("sysctl", ["-n", "security.jail.jailed"], jail: "testjail")
|
iex> Freedive.Api.Command.execute("sysctl", ["-n", "security.jail.jailed"], jail: "testjail")
|
||||||
{:ok, "1"}
|
{:ok, "1"}
|
||||||
|
|
||||||
iex> Freedive.execute("printenv", ["FOO"], jail: "testjail", env: [{"FOO", "bar"}])
|
iex> Freedive.Api.Command.execute("printenv", ["FOO"], jail: "testjail", env: [{"FOO", "bar"}])
|
||||||
{:ok, "bar"}
|
{:ok, "bar"}
|
||||||
"""
|
"""
|
||||||
@spec execute(String.t(), list(String.t()), Keyword.t()) ::
|
@spec execute(String.t(), list(String.t()), Keyword.t()) ::
|
||||||
|
|
Loading…
Reference in a new issue