# class Chef::Knife::CookbookList

### Public Instance Methods

run() click to toggle source

    # File lib/chef/knife/cookbook_list.rb, line 38
    def run
      env          = config[:environment]
      num_versions = config[:all_versions] ? "num_versions=all" : "num_versions=1"
      api_endpoint = env ? "/environments/#{env}/cookbooks?#{num_versions}" : "/cookbooks?#{num_versions}"
      cookbook_versions = rest.get_rest(api_endpoint)
      ui.output(format_cookbook_list_for_display(cookbook_versions))
    end