From a30978d20c4c1b822e6577c1548d2709d5c02daf Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Thu, 27 Oct 2022 15:08:11 +0200 Subject: [PATCH] dup: Added switch -q / --quiet to disable opening the log after running the new container. --- dup.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dup.rb b/dup.rb index c2bddc7..fb07d90 100755 --- a/dup.rb +++ b/dup.rb @@ -152,6 +152,7 @@ def action_help puts " --regenerate Generates YAML content from a running container." puts " --all Use all containers defined in yml files." puts "-v, --verbose More verbose output." + puts "-q, --quiet Don't open log after starting a new container." exit 1 end @@ -436,7 +437,9 @@ class Container if ! @data["detach"] self.attach else - self.log + unless $quiet + self.log + end end end end @@ -476,6 +479,7 @@ needs_container = true completion_str = "" silent_basedir = false $net_host = false +$quiet = false if ENV['DUP_DIR'] $base_dir = ENV['DUP_DIR'] @@ -497,6 +501,7 @@ opts = GetoptLong.new( [ '--regenerate', GetoptLong::NO_ARGUMENT ], [ '--verbose', '-v', GetoptLong::NO_ARGUMENT ], [ '--all', GetoptLong::NO_ARGUMENT ], + [ '--quiet', '-q', GetoptLong::NO_ARGUMENT ] ) opts.each do |opt, arg| @@ -532,6 +537,8 @@ opts.each do |opt, arg| $verbose = true when '--all' container = Dir[$base_dir + "/*.yml"].sort.map{|f| Container.new(File.basename(f, ".yml"))} + when '--quiet' + $quiet = true end end