Class: Pvectl::Commands::Config::View
- Inherits:
-
Object
- Object
- Pvectl::Commands::Config::View
- Defined in:
- lib/pvectl/commands/config/view.rb,
sig/pvectl/commands/config/view.rbs
Overview
Handler for the pvectl config view command.
Displays the current configuration with secrets masked. Secrets (token-secret, password) are replaced with ********.
Class Method Summary collapse
-
.execute(global_options) ⇒ Integer
Executes the view command.
-
.register_subcommand(parent) ⇒ void
Registers the view subcommand.
Class Method Details
.execute(global_options) ⇒ Integer
Executes the view command.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/pvectl/commands/config/view.rb', line 45 def self.execute() config_path = [:config] output_format = [:output] || "yaml" service = Pvectl::Config::Service.new service.load(config: config_path) masked_config = service.masked_config case output_format when "json" puts JSON.pretty_generate(masked_config) else # Default to YAML for human-readable output puts masked_config.to_yaml end 0 end |
.register_subcommand(parent) ⇒ void
This method returns an undefined value.
Registers the view subcommand.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/pvectl/commands/config/view.rb', line 23 def self.register_subcommand(parent) parent.desc "Display current configuration with masked secrets" parent.long_desc " Display the current configuration file contents. Secrets (token\n secrets, passwords) are masked for security.\n\n EXAMPLES\n $ pvectl config view\n $ pvectl config view -o yaml\n HELP\n parent.command :view do |view|\n view.action do |global_options, _options, _args|\n exit_code = execute(global_options)\n exit exit_code if exit_code != 0\n end\n end\nend\n" |