lib/command/info.rb in cpl-1.1.2 vs lib/command/info.rb in cpl-1.2.0

- old
+ new

@@ -2,11 +2,10 @@ module Command class Info < Base # rubocop:disable Metrics/ClassLength NAME = "info" OPTIONS = [ - org_option, app_option ].freeze DESCRIPTION = "Displays the diff between defined/available apps/workloads (apps equal GVCs)" LONG_DESCRIPTION = <<~DESC - Displays the diff between defined/available apps/workloads (apps equal GVCs) @@ -15,20 +14,21 @@ - Apps that are both defined and available are displayed in white - The diff is based on what's defined in the `.controlplane/controlplane.yml` file DESC EXAMPLES = <<~EX ```sh - # Shows diff for all apps in all orgs. + # Shows diff for all apps in all orgs (based on `.controlplane/controlplane.yml`). cpl info # Shows diff for all apps in a specific org. cpl info -o $ORG_NAME # Shows diff for a specific app. cpl info -a $APP_NAME ``` EX + WITH_INFO_HEADER = false def call @missing_apps_workloads = {} @missing_apps_starting_with = {} @@ -79,18 +79,15 @@ else result.reject { |app, _| find_app_options(app).nil? } end end - def orgs # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity + def orgs # rubocop:disable Metrics/MethodLength result = [] - if config.options[:org] - result.push(config.options[:org]) + if config.org + result.push(config.org) else - org_from_env = ENV.fetch("CPLN_ORG", nil) - result.push(org_from_env) if org_from_env - config.apps.each do |app_name, app_options| next if config.app && !app_matches?(config.app, app_name, app_options) org = app_options[:cpln_org] result.push(org) if org && !result.include?(org)