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
|
||||
|
||||
iex> Freedive.execute!("whoami", [], doas: true)
|
||||
iex> Freedive.Api.Command.execute!("whoami", [], doas: true)
|
||||
"root"
|
||||
|
||||
iex> Freedive.execute!("whoami", [], doas: "www")
|
||||
iex> Freedive.Api.Command.execute!("whoami", [], doas: "www")
|
||||
"www"
|
||||
|
||||
iex> Freedive.execute!("whoami", [], jail: "testjail")
|
||||
iex> Freedive.Api.Command.execute!("whoami", [], jail: "testjail")
|
||||
"root"
|
||||
|
||||
iex> Freedive.execute!("whoami", [], jail: "testjail", doas: "operator")
|
||||
iex> Freedive.Api.Command.execute!("whoami", [], jail: "testjail", doas: "operator")
|
||||
"operator"
|
||||
|
||||
iex> Freedive.execute("hostname", [], jail: "testjail")
|
||||
iex> Freedive.Api.Command.execute("hostname", [], jail: "testjail")
|
||||
{:ok, "testjail"}
|
||||
|
||||
iex> Freedive.execute!("sysctl", ["-n", "security.jail.jailed"])
|
||||
iex> Freedive.Api.Command.execute!("sysctl", ["-n", "security.jail.jailed"])
|
||||
"0"
|
||||
|
||||
iex> Freedive.execute!("sysctl", ["-n", "security.jail.jailed"], jail: "testjail")
|
||||
iex> Freedive.Api.Command.execute!("sysctl", ["-n", "security.jail.jailed"], jail: "testjail")
|
||||
"1"
|
||||
|
||||
iex> Freedive.execute!("printenv", ["FOO"], jail: "testjail", env: [{"FOO", "bar"}])
|
||||
iex> Freedive.Api.Command.execute!("printenv", ["FOO"], jail: "testjail", env: [{"FOO", "bar"}])
|
||||
"bar"
|
||||
"""
|
||||
def execute!(command, args, opts \\ []), do: raise_on_error(execute(command, args, opts))
|
||||
|
@ -49,28 +49,28 @@ defmodule Freedive.Api.Command do
|
|||
|
||||
## Examples
|
||||
|
||||
iex> Freedive.execute("whoami", [], doas: true)
|
||||
iex> Freedive.Api.Command.execute("whoami", [], doas: true)
|
||||
{:ok, "root"}
|
||||
|
||||
iex> Freedive.execute("whoami", [], doas: "www")
|
||||
iex> Freedive.Api.Command.execute("whoami", [], doas: "www")
|
||||
{:ok, "www"}
|
||||
|
||||
iex> Freedive.execute("whoami", [], jail: "testjail")
|
||||
iex> Freedive.Api.Command.execute("whoami", [], jail: "testjail")
|
||||
{:ok, "root"}
|
||||
|
||||
iex> Freedive.execute("whoami", [], jail: "testjail", doas: "operator")
|
||||
iex> Freedive.Api.Command.execute("whoami", [], jail: "testjail", doas: "operator")
|
||||
{:ok, "operator"}
|
||||
|
||||
iex> Freedive.execute("hostname", [], jail: "testjail")
|
||||
iex> Freedive.Api.Command.execute("hostname", [], jail: "testjail")
|
||||
{:ok, "testjail"}
|
||||
|
||||
iex> Freedive.execute("sysctl", ["-n", "security.jail.jailed"])
|
||||
iex> Freedive.Api.Command.execute("sysctl", ["-n", "security.jail.jailed"])
|
||||
{: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"}
|
||||
|
||||
iex> Freedive.execute("printenv", ["FOO"], jail: "testjail", env: [{"FOO", "bar"}])
|
||||
iex> Freedive.Api.Command.execute("printenv", ["FOO"], jail: "testjail", env: [{"FOO", "bar"}])
|
||||
{:ok, "bar"}
|
||||
"""
|
||||
@spec execute(String.t(), list(String.t()), Keyword.t()) ::
|
||||
|
|
Loading…
Reference in a new issue