Module: Postgres::Clone::CommandLine

Includes:
Logger
Included in:
LocalCommands, RemoteCommands
Defined in:
lib/postgres/clone/command_line.rb

Constant Summary

Constants included from Logger

Logger::DEFAULT_COLOR

Instance Method Summary collapse

Methods included from Logger

#log_message

Instance Method Details

#build_command(command, sudo: false, user: nil) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/postgres/clone/command_line.rb', line 8

def build_command(command, sudo: false, user: nil)
  if sudo
    "sudo#{user.nil? ? '' : " -u #{user}"} #{command}"
  else
    command
  end
end

#log_command(host_name, command) ⇒ Object



16
17
18
# File 'lib/postgres/clone/command_line.rb', line 16

def log_command(host_name, command)
  log_message(Rainbow("[#{host_name}] Executing: #{command}").darkgray)
end