Module: Nd::ShellScripts

Defined in:
lib/nd/shell_scripts.rb,
lib/nd/shell_scripts/version.rb

Constant Summary collapse

VERSION =
"0.1.5"

Instance Method Summary collapse

Instance Method Details

#argsObject



9
10
11
# File 'lib/nd/shell_scripts.rb', line 9

def args
  ARGV.join(' ')
end

#args?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/nd/shell_scripts.rb', line 13

def args?
  ARGV.any?
end

#command_exists?(command) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/nd/shell_scripts.rb', line 17

def command_exists?(command)
  `which #{command}`.strip.length > 0
end

#execute_and_record(command) ⇒ Object



5
6
7
# File 'lib/nd/shell_scripts.rb', line 5

def execute_and_record(command)
  exec "#{command} && rpt rec \"#{command}\""
end