diff --git a/.gitignore b/.gitignore index 5d65a8d..33ae1a0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ export .cache last_imported config.yml +config-*.yml diff --git a/Gemfile.lock b/Gemfile.lock index 310bfd4..93cd8e9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -142,4 +142,4 @@ DEPENDENCIES ynab (= 1.5.0) BUNDLED WITH - 1.17.3 + 2.0.1 diff --git a/lib/settings.rb b/lib/settings.rb index 050dcf6..877c4cb 100644 --- a/lib/settings.rb +++ b/lib/settings.rb @@ -5,7 +5,13 @@ def self.all if ENV['ENV'] == 'test' YAML.load_file(File.join('.', 'spec/config.test.yml')) else - YAML.load_file(File.join('.', 'config.yml')) + # check if the first command line parameter contains a value and use that for the config file + first_arg, *the_rest = ARGV + if !first_arg.to_s.strip.empty? + YAML.load_file(File.join('.', first_arg.to_s.strip)) + else + YAML.load_file(File.join('.', 'config.yml')) + end end end end