Skip to content

Commit

Permalink
Add new config option
Browse files Browse the repository at this point in the history
Specifies the name of config filet to read from.
Default: .babelish
  • Loading branch information
François Benaiteau committed Jul 27, 2015
1 parent f98c502 commit e12c611
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/babelish/commandline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
class Commandline < Thor
include Thor::Actions
class_option :verbose, :type => :boolean
class_option :config, :type => :string, :aliases => "-c", :desc => "Read configuration from given file", :default => ".babelish"
map "-v" => :version

CSVCLASSES = [
Expand Down Expand Up @@ -175,8 +176,8 @@ def self.exit_on_failure?

def options
original_options = super
return original_options unless File.exists?(".babelish")
defaults = ::YAML.load_file(".babelish") || {}
return original_options unless File.exists?(original_options["config"])
defaults = ::YAML.load_file(original_options["config"]) || {}
Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))
end
end
2 changes: 1 addition & 1 deletion lib/babelish/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Babelish
VERSION = "0.4.0"
VERSION = "0.4.1"
end

0 comments on commit e12c611

Please sign in to comment.