Module: Ronin::Core::CLI::Printing::Metadata

Includes:
CommandKit::Printing::Indent, CommandKit::Printing::Lists
Defined in:
lib/ronin/core/cli/printing/metadata.rb

Overview

Common methods for printing Metadata data.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(command) ⇒ Object

Adds a -v,--verbose option to the command class.

Parameters:



40
41
42
# File 'lib/ronin/core/cli/printing/metadata.rb', line 40

def self.included(command)
  command.include CommandKit::Options::Verbose
end

Instance Method Details

The class which defines the authors.

Parameters:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/ronin/core/cli/printing/metadata.rb', line 49

def print_authors(klass)
  unless klass.authors.empty?
    puts "Authors:"
    puts

    if verbose?
      indent do
        klass.authors.each do |author|
          puts "* #{author}"
          puts "  * PGP: #{author.pgp}"             if author.pgp?
          puts "  * Website: #{author.website}"     if author.website?
          puts "  * Blog: #{author.blog}"           if author.blog?
          puts "  * GitHub: #{author.github_url}"   if author.github?
          puts "  * GitLab: #{author.gitlab_url}"   if author.gitlab?
          puts "  * Twitter: #{author.twitter_url}" if author.twitter?
          puts "  * Discord: #{author.discord}"     if author.discord?
        end
      end
    else
      indent { print_list(klass.authors) }
    end

    puts
  end
end

The class which defines a description.

Parameters:



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/ronin/core/cli/printing/metadata.rb', line 80

def print_description(klass)
  if klass.description
    puts 'Description:'
    puts

    indent do
      klass.description.each_line do |line|
        puts line
      end
    end

    puts
  end
end

The class that defines references.

Parameters:



100
101
102
103
104
105
106
107
108
# File 'lib/ronin/core/cli/printing/metadata.rb', line 100

def print_references(klass)
  unless klass.references.empty?
    puts "References:"
    puts

    indent { print_list(klass.references) }
    puts
  end
end