Method: CommandMapper::Command.sudo

Defined in:
lib/command_mapper/command.rb

.sudo(params = {}, sudo: {}, **kwargs) {|command| ... } ⇒ Boolean?

Initializes and runs the command through sudo.

Parameters:

  • (defaults to: {})

    The option and argument values.

  • (defaults to: {})

    Additional sudo options.

  • Additional keyword arguments for #initialize.

Options Hash (sudo:):

  • :askpass (Boolean)

    Enables the --askpass sudo option.

  • :background (Boolean)

    Enables the --background sudo option

  • :bell (Boolean)

    Enables the --bell sudo option

  • :close_from (Integer)

    Enables the --close-from=... sudo option

  • :chdir (String)

    Enables the --chdir=... sudo option

  • :preserve_env (String)

    Enables the --preseve-env=... sudo option

  • :group (String, Boolean)

    Enables the --preseve-env=... sudo option

  • :set_home (Boolean)

    Enables the --set-home sudo option

  • :host (String)

    Enables the --host=... sudo option

  • :login (Boolean)

    Enables the --login sudo option

  • :remove_timestamp (Boolean)

    Enables the --remove-timestamp sudo option

  • :reset_timestamp (Boolean)

    Enables the --reset-timestamp sudo option

  • :non_interactive (Boolean)

    Enables the --non-interactive sudo option

  • :preserve_groups (Boolean)

    Enables the --preserve-groups sudo option

  • :prompt (String)

    Enables the --prompt=... sudo option

  • :chroot (String)

    Enables the --chroot=... sudo option

  • :role (String)

    Enables the --role=... sudo option

  • :stdin (Boolean)

    Enables the --stdin sudo option

  • :shell (Boolean)

    Enables the --shell sudo option

  • :type (String)

    Enables the --type=... sudo option

  • :command_timeout (Integer)

    Enables the --command-timeout=... sudo option

  • :other_user (String)

    Enables the --other-user=... sudo option

  • :user (String)

    Enables the --user=... sudo option

Yields:

  • (command)

    The newly initialized command.

Yield Parameters:

Returns:

API:

  • public



276
277
278
279
# File 'lib/command_mapper/command.rb', line 276

def self.sudo(params={}, sudo: {}, **kwargs,&block)
  command = new(params,**kwargs,&block)
  command.sudo_command(**sudo)
end