Sha256: e68af9733c494d837a0e7d5c654e9a03711a932820912478c643d08fc5118063
Contents?: true
Size: 949 Bytes
Versions: 1
Compression:
Stored size: 949 Bytes
Contents
# frozen_string_literal: true ## # Usage example: # # ConvenientService::Examples::Dry::Gemfile::Services::PrintShellCommand.result(text: "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 error("Printing of shell command `#{command}` is skipped") if skip out.puts out.puts ::Paint["$ #{command}", :blue, :bold] success end def fallback_result success end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
convenient_service-0.13.0 | lib/convenient_service/examples/dry/gemfile/services/print_shell_command.rb |