Class: GitHelper::HighlineCli

Inherits:
Object
  • Object
show all
Defined in:
lib/git_helper/highline_cli.rb

Instance Method Summary collapse

Instance Method Details

#accept_autogenerated_title?(autogenerated_title) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
# File 'lib/git_helper/highline_cli.rb', line 25

def accept_autogenerated_title?(autogenerated_title)
  return false unless autogenerated_title
  answer = ask("Accept the autogenerated merge request title '#{autogenerated_title}'? (y/n)")
  !!(answer =~ /^y/i)
end

#apply_template?(template_file_name) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
54
# File 'lib/git_helper/highline_cli.rb', line 51

def apply_template?(template_file_name)
  answer = ask("Apply the merge request template from #{template_file_name}? (y/n)")
  !!(answer =~ /^y/i)
end

#base_branchObject



13
14
15
# File 'lib/git_helper/highline_cli.rb', line 13

def base_branch
  ask('Base branch?')
end

#base_branch_default?(default_branch) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
# File 'lib/git_helper/highline_cli.rb', line 31

def base_branch_default?(default_branch)
  answer = ask("Is '#{default_branch}' the correct base branch for your new merge request? (y/n)")
  !!(answer =~ /^y/i)
end

#merge_method(merge_options) ⇒ Object



46
47
48
49
# File 'lib/git_helper/highline_cli.rb', line 46

def merge_method(merge_options)
  index = ask_options("Merge method?", merge_options)
  merge_options[index]
end

#merge_request_idObject



17
18
19
# File 'lib/git_helper/highline_cli.rb', line 17

def merge_request_id
  ask('Merge Request ID?')
end

#new_branch_nameObject



5
6
7
# File 'lib/git_helper/highline_cli.rb', line 5

def new_branch_name
  ask('New branch name?')
end

#pull_request_idObject



21
22
23
# File 'lib/git_helper/highline_cli.rb', line 21

def pull_request_id
  ask('Pull Request ID?')
end

#remove_source_branch?Boolean

Returns:

  • (Boolean)


41
42
43
44
# File 'lib/git_helper/highline_cli.rb', line 41

def remove_source_branch?
  answer = ask('Remove source branch after merging? (y/n)')
  !!(answer =~ /^y/i)
end

#squash_merge_request?Boolean

Returns:

  • (Boolean)


36
37
38
39
# File 'lib/git_helper/highline_cli.rb', line 36

def squash_merge_request?
  answer = ask('Squash merge request? (y/n)')
  !!(answer =~ /^y/i)
end

#template_to_apply(template_options, request_type) ⇒ Object



56
57
58
59
60
# File 'lib/git_helper/highline_cli.rb', line 56

def template_to_apply(template_options, request_type)
  complete_options = template_options << 'None'
  index = ask_options("Which #{request_type} request template should be applied?", complete_options)
  complete_options[index]
end

#titleObject



9
10
11
# File 'lib/git_helper/highline_cli.rb', line 9

def title
  ask('Title?')
end