Sha256: 24bca047945e269e6ccf0d83b2081515e59b3ca9d19c539fbc4f4d9eda23147d

Contents?: true

Size: 1.06 KB

Versions: 343

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require 'active_support/concern'
require 'eac_ruby_utils/envs/ssh_env/dasho_options'
require 'eac_ruby_utils/listable'
require 'eac_ruby_utils/patches/object/if_present'

module EacRubyUtils
  module Envs
    class SshEnv < ::EacRubyUtils::Envs::BaseEnv
      module Terminal
        extend ::ActiveSupport::Concern

        included do
          include ::EacRubyUtils::Envs::SshEnv::DashoOptions
          add_nodasho_option('Terminal')
          include ::EacRubyUtils::Listable
          lists.add_string :terminal_option, :auto, :disable, :enable, :force
        end

        def ssh_command_line_terminal_args(value)
          self.class.lists.terminal_option.value_validate!(value)
          case value
          when TERMINAL_OPTION_AUTO then ENV['TERM'].present? ? %w[-t] : []
          when TERMINAL_OPTION_DISABLE then ['-T']
          when TERMINAL_OPTION_ENABLE then ['-t']
          when TERMINAL_OPTION_FORCE then ['-tt']
          else raise "Invalid conditional branch: #{value}"
          end
        end
      end
    end
  end
end

Version data entries

343 entries across 343 versions & 4 rubygems

Version Path
eac_ruby_utils-0.123.0 lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_ruby_utils-0.121.0 lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_ruby_utils-0.120.0 lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_tools-0.76.1 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_tools-0.76.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_tools-0.75.2 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_ruby_utils-0.119.2 lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_tools-0.75.1 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_tools-0.75.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_ruby_utils-0.119.1 lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_tools-0.74.1 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_tools-0.74.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_tools-0.73.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_ruby_utils-0.119.0 lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_tools-0.72.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_ruby_utils-0.118.1 lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_ruby_utils-0.118.0 lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_tools-0.70.1 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_tools-0.70.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb
eac_tools-0.69.1 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb