Class: KBSecret::CLI::Command::Generators

Inherits:
Abstract
  • Object
show all
Defined in:
lib/kbsecret/cli/command/generators.rb

Overview

The implementation of kbsecret generators.

Instance Attribute Summary

Attributes inherited from Abstract

#cli

Instance Method Summary collapse

Methods inherited from Abstract

command_name, config, #setup!, #validate!

Constructor Details

#initialize(argv) ⇒ Generators

Returns a new instance of Generators.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/kbsecret/cli/command/generators.rb', line 8

def initialize(argv)
  super(argv) do |cli|
    cli.slop do |o|
      o.banner = "        Usage:\n          kbsecret generators [options]\n      HELP\n\n      o.bool \"-a\", \"--show-all\", \"show each generator in depth (i.e. metadata)\"\n    end\n  end\nend\n"

Instance Method Details

#run!Object

See Also:



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/kbsecret/cli/command/generators.rb', line 22

def run!
  Config[:generators].each do |label, config|
    puts label

    next unless cli.opts.show_all?

    puts "      \\tFormat: \#{config[:format]}\n      \\tLength: \#{config[:length]}\n    DETAIL\n  end\nend\n"