Extract xargs helper

This commit is contained in:
David Heinemeier Hansson
2023-02-03 16:27:10 +01:00
parent 3c1053fedd
commit d263b0ffa5
2 changed files with 6 additions and 2 deletions

View File

@@ -28,7 +28,7 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
end
def stop
pipe current_container_id, "xargs docker stop"
pipe current_container_id, xargs(docker(:stop))
end
def info
@@ -83,7 +83,7 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
def remove_container(version:)
pipe \
container_id_for(container_name: service_with_version(version)),
[ "xargs", docker(:container, :rm) ].flatten
xargs(docker(:container, :rm))
end
def remove_containers

View File

@@ -28,6 +28,10 @@ module Mrsk::Commands
combine *commands, by: "|"
end
def xargs(command)
[ :xargs, command ].flatten
end
def docker(*args)
args.compact.unshift :docker
end