You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cookbook_metadata.rb
    path of file: ./repos/chef/knife/lib/chef/knife
    
    the code of the file until where you have to start completion: #
# Author:: Adam Jacob (<adam@chef.io>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exce
    
      def run
        config[:cookbook_path] ||= Chef::Config[:cookbook_path]

        if config[:all]
          cl = Chef::CookbookLoader.new(config[:cookbook_path])
          cl.load_cookbooks
          cl.each_key do |cname|
            generate_metadata(cname.to_s)
          end
        else
          cookbook_name = @name_args[0]
          if cookbook_name.nil? || cookbook_name.empty?
            ui.error "You must specify the cookbook to generate metadata for, or use the --all option."
            exit 1
          end