<commit_before>require 'MrMurano/Solution'

command :domain do |c|
  c.syntax = %{murano domain}
  c.summary = %{Print the domain for this solution}
  c.description = %{
Print the domain for this solution.
  }.strip
  c.option '--[no-]raw', %{Don't add scheme}
  c.option '--[no-]brief', %{Show the URL but not the solution ID}

  # Add the flags: --types, --ids, --names, --[no]-header.
  command_add_solution_pickers c

  c.action do |args,options|
    options.default :raw=>true

    solz = must_fetch_solutions!(options)

    domain_s = MrMurano::Verbose::pluralize?("domain", solz.length)
    MrMurano::Verbose::whirly_start "Fetching #{domain_s}..."
    solz.each do |soln|
      # Get the solution info; stores the result in the Solution object.
      desc = soln.info
    end
    MrMurano::Verbose::whirly_stop

    solz.each do |soln|
      unless options.brief
        say soln.pretty_desc(add_type=true, no_raw=!options.raw)
      else
        if options.raw then
          say soln.desc[:domain]
        else
          say "https://#{soln.desc[:domain]}"
        end
      end
    end

  end
end
alias_command 'domain product', 'domain', '--type', 'product'
alias_command 'domain products', 'domain', '--type', 'product'
alias_command 'domain prod', 'domain', '--type', 'product'
alias_command 'domain prods', 'domain', '--type', 'product'
alias_command 'domain application', 'domain', '--type', 'application'
alias_command 'domain applications', 'domain', '--type', 'application'
alias_command 'domain app', 'domain', '--type', 'application'
alias_command 'domain apps', 'domain', '--type', 'application'

#  vim: set ai et sw=2 ts=2 :
<commit_msg>Update domain.rb to use new Solution objects, rather than expect a Hash; also make Rubocop compliant.<commit_after># Last Modified: 2017.07.01 /coding: utf-8
# frozen_string_literal: true

# Copyright © 2016-2017 Exosite LLC.
# License: MIT. See LICENSE.txt.
#  vim:tw=0:ts=2:sw=2:et:ai

require 'MrMurano/Solution'
require 'MrMurano/commands/solution'

command :domain do |c|
  c.syntax = %(murano domain)
  c.summary = %(Print the domain for this solution)
  c.description = %(
Print the domain for this solution.
  ).strip
  c.option '--[no-]raw', %(Don't add scheme (default with brief))
  c.option '--[no-]brief', %(Show the URL but not the solution ID)

  # Add the flags: --types, --ids, --names, --[no]-header.
  command_add_solution_pickers c

  c.action do |args, options|
    options.default(raw: true) if options.brief

    c.verify_arg_count!(args)

    solz = must_fetch_solutions!(options)

    domain_s = MrMurano::Verbose.pluralize?('domain', solz.length)
    MrMurano::Verbose.whirly_start("Fetching #{domain_s}...")
    solz.each do |soln|
      # Get the solution info; stores the result in the Solution object.
      _meta = soln.info_safe
    end
    MrMurano::Verbose.whirly_stop

    solz.each do |sol|
      if !options.brief
        say(sol.pretty_desc(add_type: true, raw_url: options.raw))
      elsif options.raw
        say(sol.domain)
      else
        say("https://#{sol.domain}")
      end
    end
  end
end
alias_command 'domain product', 'domain', '--type', 'product'
alias_command 'domain products', 'domain', '--type', 'product'
alias_command 'domain prod', 'domain', '--type', 'product'
alias_command 'domain prods', 'domain', '--type', 'product'
alias_command 'domain application', 'domain', '--type', 'application'
alias_command 'domain applications', 'domain', '--type', 'application'
alias_command 'domain app', 'domain', '--type', 'application'
alias_command 'domain apps', 'domain', '--type', 'application'

{'fraction_non_alphanumeric': 0.15056739551619153, 'fraction_numerical': 0.006089122612787158, 'mean_word_length': 3.651222651222651, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '6864322', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1177, 'n_words': 341}