Class: Vaultez::CLI

Inherits:
Thor
  • Object
show all
Includes:
Vaultez::Commands::Auth, Vaultez::Commands::ConfigCommand, Vaultez::Commands::Fetch
Defined in:
lib/vaultez/cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CLI

Returns a new instance of CLI.



18
19
20
21
# File 'lib/vaultez/cli.rb', line 18

def initialize(*args)
  super
  ENV["VAULTEZ_TOKEN"] = options[:token] if options[:token]
end

Instance Method Details

#__versionObject



86
87
88
# File 'lib/vaultez/cli.rb', line 86

def __version
  puts "vaultez-cli #{Vaultez::VERSION}"
end

#configObject



83
# File 'lib/vaultez/cli.rb', line 83

def config; super; end

#fetchObject



73
# File 'lib/vaultez/cli.rb', line 73

def fetch; super; end

#help(command = nil, subcommand: false) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/vaultez/cli.rb', line 90

def help(command = nil, subcommand: false)
  if command
    super
  else
    puts "Vaultez CLI — secure secret management from your terminal"
    puts
    puts "Usage: vaultez <command> [options]"
    puts
    puts "Commands:"
    puts "  login       Authenticate with email, password, and 2FA code"
    puts "  logout      Revoke the current session token"
    puts "  fetch       Fetch secrets from a project"
    puts "  config      Set default company or token"
    puts "  help        Show help for any command"
    puts
    puts "Options:"
    puts "  --token     Use a project token instead of the saved session"
    puts "  --version   Show the installed CLI version"
    puts
    puts "Examples:"
    puts "  vaultez login"
    puts "  vaultez fetch --project=\"Backend\""
    puts "  vaultez fetch --project=\"Backend\" --secret=\"DATABASE_URL\""
    puts "  vaultez fetch --token=\"vz_...\""
    puts "  vaultez fetch --token=\"vz_...\" --secret=\"DATABASE_URL\""
  end
end

#loginObject



34
# File 'lib/vaultez/cli.rb', line 34

def ; super; end

#logoutObject



43
# File 'lib/vaultez/cli.rb', line 43

def logout; super; end