<commit_before>require "heroku/command/base"

# manage apps (create, destroy)
#
class Heroku::Command::Apps < Heroku::Command::Base

  # apps
  #
  # list your apps
  #
  #Example:
  #
  # $ heroku apps
  # === My Apps
  # myapp1
  # myapp2
  #
  # === Collaborated Apps
  # theirapp1   <EMAIL>
  #
  def index
    validate_arguments!
    apps = api.get_apps.body
    unless apps.empty?
      my_apps, collaborated_apps = apps.partition do |app|
        app["owner_email"] == Heroku::Auth.user
      end

      unless my_apps.empty?
        styled_header("My Apps")
        styled_array(my_apps.map { |app| app["name"] })
      end

      unless collaborated_apps.empty?
        styled_header("Collaborated Apps")
        styled_array(collaborated_apps.map { |app| [app["name"], app["owner_email"]] })
      end
    else
      display("You have no apps.")
    end
  end

  alias_command "list", "apps"

  # apps:info
  #
  # show detailed app information
  #
  # -r, --raw  # output info as raw key/value pairs
  #
  #Examples:
  #
  # $ heroku apps:info
  # === myapp
  # Git URL:   <EMAIL>@<EMAIL>.com:myapp.git
  # Repo Size: 5M
  # ...
  #
  # $ heroku apps:info --raw
  # git_url=git@heroku.com:myapp.git
  # repo_size=5000000
  # ...
  #
  def info
    validate_arguments!
    app_data = api.get_app(app).body

    unless options[:raw]
      styled_header(app_data["name"])
    end

    addons_data = api.get_addons(app).body.map {|addon| addon["description"]}.sort
    collaborators_data = api.get_collaborators(app).body.map {|collaborator| collaborator["email"]}.sort
    collaborators_data.reject! {|email| email == app_data["owner_email"]}
    domain_name = (domains_data = api.get_domains(app).body) && domains_data.first && domains_data.first["domain"]

    if options[:raw]
      if domain_name
        app_data["domain_name"] = domain_name
      end
      unless addons_data.empty?
        app_data['addons'] = addons_data.join(',')<commit_msg>display addon names, rather than descriptions, in apps:info these convey more info and are more inline with addons:list<commit_after>require "heroku/command/base"

# manage apps (create, destroy)
#
class Heroku::Command::Apps < Heroku::Command::Base

  # apps
  #
  # list your apps
  #
  #Example:
  #
  # $ heroku apps
  # === My Apps
  # myapp1
  # myapp2
  #
  # === Collaborated Apps
  # theirapp1   <EMAIL>
  #
  def index
    validate_arguments!
    apps = api.get_apps.body
    unless apps.empty?
      my_apps, collaborated_apps = apps.partition do |app|
        app["owner_email"] == Heroku::Auth.user
      end

      unless my_apps.empty?
        styled_header("My Apps")
        styled_array(my_apps.map { |app| app["name"] })
      end

      unless collaborated_apps.empty?
        styled_header("Collaborated Apps")
        styled_array(collaborated_apps.map { |app| [app["name"], app["owner_email"]] })
      end
    else
      display("You have no apps.")
    end
  end

  alias_command "list", "apps"

  # apps:info
  #
  # show detailed app information
  #
  # -r, --raw  # output info as raw key/value pairs
  #
  #Examples:
  #
  # $ heroku apps:info
  # === myapp
  # Git URL:   <EMAIL>:myapp.git
  # Repo Size: 5M
  # ...
  #
  # $ heroku apps:info --raw
  # git_url=<EMAIL>:myapp.git
  # repo_size=5000000
  # ...
  #
  def info
    validate_arguments!
    app_data = api.get_app(app).body

    unless options[:raw]
      styled_header(app_data["name"])
    end

    addons_data = api.get_addons(app).body.map {|addon| addon['name']}.sort
    collaborators_data = api.get_collaborators(app).body.map {|collaborator| collaborator["email"]}.sort
    collaborators_data.reject! {|email| email == app_data["owner_email"]}
    domain_name = (domains_data = api.get_domains(app).body) && domains_data.first && domains_data.first["domain"]

    if options[:raw]
      if domain_name
        app_data["domain_name"] = domain_name
      end
      unless addons_data.empty?
        app_data['addons'] = addons_data.join(',')
{'fraction_non_alphanumeric': 0.13506753376688344, 'fraction_numerical': 0.005502751375687844, 'mean_word_length': 2.9282907662082516, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7360513', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1389, 'n_words': 278}