class Toolshed::Commands::CheckoutBranch
Public Class Methods
cli_options()
click to toggle source
# File lib/toolshed/commands/checkout_branch.rb, line 6 def self.cli_options { banner: 'Usage: checkout_branch [options]', options: { branch_name: { short_on: '-b', } } } end
Public Instance Methods
execute(args, options = {})
click to toggle source
# File lib/toolshed/commands/checkout_branch.rb, line 17 def execute(args, options = {}) branch_name = read_user_input("Ticket ID or Branch Name:", options) Toolshed::Git::Branch.checkout(branch_name) Toolshed.die end
read_user_input(message, options)
click to toggle source
# File lib/toolshed/commands/checkout_branch.rb, line 23 def read_user_input(message, options) return options[:branch_name] if (options.has_key?(:branch_name)) puts message value = $stdin.gets.chomp until (!value.empty?) puts "Branch name cannot be empty" puts message value = $stdin.gets.chomp end value end