Sha256: 850ab7f5d7ba5bf0dcd6bd267e0bf9e6fc4c6d965a08c5c678e2b464ef9e21c9

Contents?: true

Size: 732 Bytes

Versions: 2

Compression:

Stored size: 732 Bytes

Contents

# frozen_string_literal: true

##
# Usage example:
#
#   ConvenientService::Examples::Dry::Gemfile::Services::PrintShellCommand.result(text: "ls -a")
#
module ConvenientService
  module Examples
    module Dry
      module Gemfile
        module Services
          class PrintShellCommand
            include DryService::Config

            option :text
            option :out, default: -> { $stdout }

            contract do
              schema do
                required(:text).value(:string)
              end
            end

            def result
              out.puts

              out.puts ::Paint["$ #{text}", :blue, :bold]

              success
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
convenient_service-0.2.0 lib/convenient_service/examples/dry/gemfile/services/print_shell_command.rb
convenient_service-0.1.0 lib/convenient_service/examples/dry/gemfile/services/print_shell_command.rb