Method: Knifecmd#initialize
- Defined in:
- lib/kknife/knifecmd.rb
#initialize(argopts = {}) ⇒ Knifecmd
Returns a new instance of Knifecmd.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/kknife/knifecmd.rb', line 35 def initialize( argopts = {} ) # Root command is k.. or knife @root = 'knife' opts = { :commands => ARGV.dup.freeze, :cmd_found => [], :cmd_left => ARGV.dup, :shortcuts => {}, :ambiguities => {}, :config_build => '~/.chef/.kknife.built.config', :config_user => '~/.chef/.kknife.user.config', }.merge argopts @commands = opts[:commands] @cmd_found = opts[:cmd_found] @cmd_left = opts[:cmd_left] @shortcuts = opts[:shortcuts] @ambiguities = opts[:ambiguities] @config_build = File. opts[:config_build] @config_user = File. opts[:config_user] @cmd_root = Command.new( @root, :controller => self ) # Instead of trawling for chef files each time we can load a previous config lookup_files unless lookup_config # Now process the knife commands into a tree of Command load_commands # Then setup to find commands reset_found end |