Sha256: df02c838e1e0ee05d1655af7629bfa79812f4e3f264a55cc9b3c900c6b320a7d

Contents?: true

Size: 1.04 KB

Versions: 16

Compression:

Stored size: 1.04 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'

# Borrowing from "whiches" gem ...
cmd  = 'knife'
exes = []
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
  exts.each { |ext|
    exe = File.join(path, "#{cmd}#{ext}")
    exes << exe if File.executable? exe
  }
end
path = if exes.size > 0
         File.dirname(exes[0])
       else
         File.dirname(__FILE__)
       end

$:.unshift(File.expand_path(File.join(path, "..", "lib")))
require 'chef/application/knife'
require 'chef/knife/bootstrap'

# If it is translate,upload we will let the uploader do the heavy lifting
verb = 'upload'
me   = 'chop' # File.basename(__FILE__)
act  = false
ARGV.each{|w|
  if w.match(%r(^--action$))
    act = true
  else
    case w
      when 'upload'
        verb = w
      when 'translate'
        verb = w
      else
        if act
          aw = w.split(%r([:,]))
          verb = aw[0] if aw
        end
    end
  end
}
ARGV.unshift verb unless ARGV[0] == verb
ARGV.unshift me
Chef::Application::Knife.new.run

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
knife-chop-0.5.15 bin/chop
knife-chop-0.4.1 bin/chop
knife-chop-0.4.0 bin/chop
knife-chop-0.3.7 bin/chop
knife-chop-0.3.6 bin/chop
knife-chop-0.3.5 bin/chop
knife-chop-0.3.4 bin/chop
knife-chop-0.3.3 bin/chop
knife-chop-0.3.2 bin/chop
knife-chop-0.3.0 bin/chop
knife-chop-0.3.1 bin/chop
knife-chop-0.2.11 bin/chop
knife-chop-0.2.9 bin/chop
knife-chop-0.2.7 bin/chop
knife-chop-0.2.8 bin/chop
knife-chop-0.2.6 bin/chop