Sha256: bbdbebe537a39ca1d7b8069d8312a9b52de6e7d9e5c36ac1908357e05ee4ab81
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
require 'readline' class GitlabClusterHelper class Runner def initialize(manager: GitlabClusterHelper::Manager.new, readline_class: Readline, output: $stdout) @manager = manager @readline_class = readline_class @output = output end def start print_help while line = @readline_class.readline('> ', true) if command = commands[line] command[:command].call end @output.puts Messages::GOODBYE && break if line == 'q' print_help end end private def commands { 'c' => { message: Messages::CREATE, command: method(:create) }, 'q' => { message: Messages::QUIT, command: @manager.method(:cleanup) }, } end def create cluster = @manager.create @output.puts <<~END Name: #{cluster.name} Api URL: #{cluster.api_url} Ca Certificate: #{cluster.ca_certificate} Token: #{cluster.token} END end def print_help commands.each do |key, command| @output.puts "#{key}) #{command[:message]}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gitlab-cluster-helper-0.1.0 | lib/gitlab_cluster_helper/runner.rb |