Class: Pgai::Cli::Main

Inherits:
Base
  • Object
show all
Defined in:
lib/pgai/cli/main.rb

Instance Method Summary collapse

Methods inherited from Base

exit_on_failure?, #initialize

Constructor Details

This class inherits a constructor from Pgai::Cli::Base

Instance Method Details

#configObject



5
6
7
8
9
10
11
# File 'lib/pgai/cli/main.rb', line 5

def config
  token = ask("Access token:", echo: false)

  Pgai::Resources::Local::Configuration
    .new(clone_prefix: options[:prefix], access_token: token)
    .save
end

#connect(name) ⇒ Object



14
15
16
17
18
# File 'lib/pgai/cli/main.rb', line 14

def connect(name)
  with_env(name) do |env|
    Pgai::CloneManager.new(env).connect
  end
end

#destroy(name) ⇒ Object



21
22
23
24
25
# File 'lib/pgai/cli/main.rb', line 21

def destroy(name)
  with_env(name) do |env|
    Pgai::CloneManager.new(env).cleanup
  end
end

#reset(name) ⇒ Object



28
29
30
31
32
# File 'lib/pgai/cli/main.rb', line 28

def reset(name)
  with_env(name) do |env|
    Pgai::CloneManager.new(env).reset
  end
end

#use(*command) ⇒ Object



36
37
38
39
40
# File 'lib/pgai/cli/main.rb', line 36

def use(*command)
  envs = options.fetch(:only) { Pgai::Resources::Local::Environment.all.map(&:alias) }

  Pgai::ExternalCommandManager.new(envs, command).run
end