Module: Ronin::Core::CLI::Generator::Options::Author
- Defined in:
- lib/ronin/core/cli/generator/options/author.rb
Overview
Adds the -a,--author NAME
and -e,--author-email EMAIL
options
for the generator command.
Instance Attribute Summary collapse
-
#author_email ⇒ String
readonly
The author email.
-
#author_name ⇒ String
readonly
The author name.
Class Method Summary collapse
-
.default_email ⇒ String?
The default author email.
-
.default_name ⇒ String?
The default author name.
-
.included(command) ⇒ Object
Defines the
-a,--author NAME
and-e,--author-email EMAIL
options.
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Object
Initializes #author_name and #author_email.
Instance Attribute Details
#author_email ⇒ String (readonly)
The author email.
86 87 88 |
# File 'lib/ronin/core/cli/generator/options/author.rb', line 86 def @author_email end |
#author_name ⇒ String (readonly)
The author name.
81 82 83 |
# File 'lib/ronin/core/cli/generator/options/author.rb', line 81 def @author_name end |
Class Method Details
.default_email ⇒ String?
The default author email.
45 46 47 |
# File 'lib/ronin/core/cli/generator/options/author.rb', line 45 def self.default_email Core::Git.user_email end |
.default_name ⇒ String?
The default author name.
36 37 38 |
# File 'lib/ronin/core/cli/generator/options/author.rb', line 36 def self.default_name Core::Git.user_name || ENV['USERNAME'] end |
.included(command) ⇒ Object
Defines the -a,--author NAME
and -e,--author-email EMAIL
options.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/ronin/core/cli/generator/options/author.rb', line 56 def self.included(command) command.option :author, short: '-a', value: { type: String, usage: 'NAME', default: -> { default_name } }, desc: 'The name of the author' do || @author_name = end command.option :author_email, short: '-e', value: { type: String, usage: 'EMAIL', default: -> { default_email } }, desc: 'The email address of the author' do |email| @author_email = email end end |
Instance Method Details
#initialize(**kwargs) ⇒ Object
Initializes #author_name and #author_email.
94 95 96 97 98 99 |
# File 'lib/ronin/core/cli/generator/options/author.rb', line 94 def initialize(**kwargs) super(**kwargs) @author_name = Author.default_name @author_email = Author.default_email end |