require "devops-client/options/common_options"

class ScriptOptions < CommonOptions

  commands :list, :add, :delete, :run, :command

  COMMAND_NAME = "script"

  def initialize args, def_options
    super(args, def_options)
    self.header = I18n.t("headers.script")
    sname = "SCRIPT_NAME"
    self.add_params = [sname, "FILE"]
    self.delete_params = [sname]
    self.run_params = [sname, "NODE_NAME", "[NODE_NAME ...]"]
    self.command_params = ["NODE_NAME", "'sh command'"]
  end

  def run_options
    options do |parser, options|
      parser.banner << self.delete_banner

      parser.recognize_option_value(:params, resource_name: :script) do |params|
        options[:params] = params.split(",")
      end
    end
  end

end
