Sha256: da43d51bc9f758188d933907d41c5c5badd00babe7b493420f8d055d7a1e9340
Contents?: true
Size: 962 Bytes
Versions: 4
Compression:
Stored size: 962 Bytes
Contents
# frozen_string_literal: true ## # Usage example: # # ConvenientService::Examples::Dry::Gemfile::Services::PrintShellCommand.result(command: "ls -a") # module ConvenientService module Examples module Dry class Gemfile module Services class PrintShellCommand include DryService::Config option :command option :skip, default: -> { false } option :out, default: -> { $stdout } contract do schema do required(:command).filled(:string) end end def result return failure("Printing of shell command `#{command}` is skipped") if skip out.puts out.puts ::Paint["$ #{command}", :blue, :bold] success end def fallback_failure_result success end end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems