aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 0ecc06d2a..82bc38895 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -517,3 +517,19 @@ def migrate_legacy_keg_symlinks_if_necessary
end
FileUtils.rm_rf legacy_pinned_kegs
end
+
+def puts_hash(hash, indent: 0)
+ return hash unless hash.is_a? Hash
+ hash.each do |key, value|
+ indent_spaces = " " * (indent * 2)
+ printf "#{indent_spaces}#{key}:"
+ if value.is_a? Hash
+ puts
+ puts_hash(value, indent: indent+1)
+ else
+ puts " #{value}"
+ end
+ end
+ hash
+end
+alias ph puts_hash