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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# 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}"

          if author.pgp?
            puts "  * PGP: #{author.pgp}"
          end

          if author.website?
            puts "  * Website: #{author.website}"
          end

          if author.blog?
            puts "  * Blog: #{author.blog}"
          end

          if author.github?
            puts "  * GitHub: #{author.github_url}"
          end

          if author.gitlab?
            puts "  * GitLab: #{author.gitlab_url}"
          end

          if author.twitter?
            puts "  * Twitter: #{author.twitter_url}"
          end

          if author.mastodon?
            puts "  * Mastodon: #{author.mastodon_url}"
          end

          if author.discord?
            puts "  * Discord: #{author.discord}"
          end
        end
      end
    else
      indent { print_list(klass.authors) }
    end

    puts
  end
end

The class which defines a description.

Parameters:



105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/ronin/core/cli/printing/metadata.rb', line 105

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:



125
126
127
128
129
130
131
132
133
# File 'lib/ronin/core/cli/printing/metadata.rb', line 125

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

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