Sha256: fbcbeefe4aa42028be98d912b086f868f33e114448360aaf278785007de5fc95
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true ## # Usage example: # # ConvenientService::Examples::Standard::Gemfile::Services::PrintShellCommand.result(command: "ls -a") # module ConvenientService module Examples module Standard class Gemfile module Services class PrintShellCommand include ConvenientService::Standard::Config attr_reader :command, :skip, :out def initialize(command:, skip: false, out: $stdout) @command = command @skip = skip @out = out end def result return error("Command is `nil`") if command.nil? return error("Command is empty?") if command.empty? 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