summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-08-04 21:43:49 -0700
committerBryan McLellan <btm@loftninjas.org>2018-08-07 11:05:12 -0400
commitcef40a265f702a488482879e4d5c86f6d7717d5e (patch)
tree6ea5d173aa14c31295f08773b50eae2ea40a2009
parentca3bc9840213cca6774982a64115118c9b64a187 (diff)
downloadohai-cef40a265f702a488482879e4d5c86f6d7717d5e.tar.gz
Switch to just using --directory more than once
I wasn't aware that this was our standard way of doing this. Works for me. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--RELEASE_NOTES.md11
-rw-r--r--lib/ohai/application.rb10
2 files changed, 15 insertions, 6 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 8e7afa2b..b104e9ad 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,3 +1,14 @@
+# UNRELEASED
+
+## Multiple plugin directories
+
+You can now specify more than one directory to load additional Ohai plugins from by using the `--directory` / `-d` flag more than once.
+
+Example:
+```bash
+ohai -d /path/to/more/plugins -d /another/path/to/more/plugins
+```
+
# Ohai Release Notes 14.3
## Detection of Amazon Linux 2.0
diff --git a/lib/ohai/application.rb b/lib/ohai/application.rb
index f64f9e97..dc16d111 100644
--- a/lib/ohai/application.rb
+++ b/lib/ohai/application.rb
@@ -34,12 +34,10 @@ class Ohai::Application
option :directory,
short: "-d DIRECTORY",
long: "--directory DIRECTORY",
- description: "A directory to add to the Ohai plugin search path. If passing multiple directories comma separate directories.",
- proc: lambda { |paths|
- paths = paths.split(",")
- paths.map do |path|
- Ohai::Config.platform_specific_path(path)
- end
+ description: "A directory to add to the Ohai plugin search path. If passing multiple directories use this option more than once.",
+ proc: lambda { |path, path_array|
+ (path_array ||= []) << Ohai::Config.platform_specific_path(path)
+ path_array
}
option :log_level,