# frozen_string_literal: true require "thor" require_relative "list" require_relative "show" require_relative "upsert" require_relative "delete_all" require_relative "delete" require_relative "update" require_relative "../../sub_command_base" module Neetob class CLI module Github module Labels class Commands < SubCommandBase class_option :apps, type: :array, aliases: "-a", desc: "Github app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web\"" class_option :all_neeto_repos, type: :boolean, aliases: "--all", default: false, desc: "Use this flag for working with all neeto repos" desc "list", "List all the labels in the Github repos" def list List.new(options[:apps], options[:sandbox], options[:all_neeto_repos]).run end desc "show", "Show details about the given label in the Github repos" option :name, type: :string, aliases: "-n", required: true, desc: "Name of the label" def show Show.new(options[:apps], options[:name], options[:sandbox], options[:all_neeto_repos]).run end desc "upsert", "Create and update labels in the Github repos" option :path, type: :string, aliases: "-p", desc: "The JSON file path which has a list of all the required labels. Each label should have name. The color and description are optional" def upsert Upsert.new(options[:apps], options[:path], options[:sandbox], options[:all_neeto_repos]).run end desc "delete_all", "Delete all the labels from the Github repos" def delete_all DeleteAll.new(options[:apps], options[:sandbox], options[:all_neeto_repos]).run end desc "delete", "Delete some labels from the Github repos" option :labels, type: :array, required: true, desc: "Labels you want to delete from the repos." def delete Delete.new(options[:apps], options[:labels], options[:sandbox], options[:all_neeto_repos]).run end desc "update", "Update a label name in Github repos" option :old_name, type: :string, required: true, desc: "Current label name which needs to be updated" option :new_name, type: :string, required: true, desc: "New name for the updated label" def update Update.new( options[:apps], options[:old_name], options[:new_name], options[:sandbox], options[:all_neeto_repos]).run end end end end end end