Class: Dotenv::CLI
- Inherits:
-
OptionParser
- Object
- OptionParser
- Dotenv::CLI
- Defined in:
- lib/dotenv/cli.rb
Overview
The ‘dotenv` command line interface. Run `$ dotenv –help` to see usage.
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
-
#filenames ⇒ Object
readonly
Returns the value of attribute filenames.
-
#overwrite ⇒ Object
readonly
Returns the value of attribute overwrite.
Instance Method Summary collapse
-
#initialize(argv = []) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv = []) ⇒ CLI
Returns a new instance of CLI.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/dotenv/cli.rb', line 11 def initialize(argv = []) @argv = argv.dup @filenames = [] @ignore = false @overwrite = false super("Usage: dotenv [options]") separator "" on("-f FILES", Array, "List of env files to parse") do |list| @filenames = list end on("-i", "--ignore", "ignore missing env files") do @ignore = true end on("-o", "--overwrite", "overwrite existing ENV variables") do @overwrite = true end on("--overload") { @overwrite = true } on("-h", "--help", "Display help") do puts self exit end on("-v", "--version", "Show version") do puts "dotenv #{Dotenv::VERSION}" exit end on("-t", "--template=FILE", "Create a template env file") do |file| template = Dotenv::EnvTemplate.new(file) template.create_template end order!(@argv) end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
9 10 11 |
# File 'lib/dotenv/cli.rb', line 9 def argv @argv end |
#filenames ⇒ Object (readonly)
Returns the value of attribute filenames.
9 10 11 |
# File 'lib/dotenv/cli.rb', line 9 def filenames @filenames end |
#overwrite ⇒ Object (readonly)
Returns the value of attribute overwrite.
9 10 11 |
# File 'lib/dotenv/cli.rb', line 9 def overwrite @overwrite end |