class LaunchdTools::Cmd2LaunchdCli

Attributes

args[R]

Public Class Methods

new(args) click to toggle source
# File lib/launchd_tools/cmd2launchd_cli.rb, line 7
def initialize(args)
  if args.empty?
    show_usage
    exit 0
  elsif args.length == 1
    case args.first
    when "--help"
      show_usage
      exit 0
    when "-h"
      show_usage
      exit 0
    when "--version"
      puts LaunchdTools::VERSION
      exit 0
    end
  end
  @args = args
end

Public Instance Methods

run() click to toggle source
# File lib/launchd_tools/cmd2launchd_cli.rb, line 31
def run
  plist = LaunchdPlist.new
  plist.add_program_args(args)
  puts plist.to_s
end
show_usage() click to toggle source
# File lib/launchd_tools/cmd2launchd_cli.rb, line 27
def show_usage
  puts "Usage: #{$0} command [arg1] [arg2]"
end