Class: Git::Copilot::CLI

Inherits:
Thor
  • Object
show all
Includes:
Configuration
Defined in:
lib/git/copilot/cli.rb,
lib/git/copilot/cli/user.rb

Defined Under Namespace

Classes: User

Instance Method Summary collapse

Instance Method Details

#initObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/git/copilot/cli.rb', line 12

def init
  if File.exist?(config_file_path) && !options[:force]
    return say_status "ERROR", "Configuration file already exists", :red
  end

  say "Writing configuration file to #{config_file_path}"
  File.write(config_file_path, empty_configuration)

  solo
end

#pair(*usernames) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/git/copilot/cli.rb', line 30

def pair(*usernames)
  authors = usernames.map do |username|
    users.fetch(username) do
      say_status "WARNING", "Unknown user #{username}", :yellow
      next
    end
  end.compact

  write_template(authors: authors)
  set_git_commit_template
end

#soloObject



24
25
26
27
# File 'lib/git/copilot/cli.rb', line 24

def solo
  write_template
  set_git_commit_template
end