From 302ba3eb254e8f7eb818926e8c36ee8a0ba60009 Mon Sep 17 00:00:00 2001 From: Harshad Sharma Date: Tue, 28 May 2024 00:49:26 +0530 Subject: [PATCH] Fix doctests --- lib/freedive/api/command.ex | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/freedive/api/command.ex b/lib/freedive/api/command.ex index c68ea50..488bcef 100644 --- a/lib/freedive/api/command.ex +++ b/lib/freedive/api/command.ex @@ -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()) ::