Sha256: 97b17cecda37542691702e602f07301b797d927b6e490e0d3148f5d9e23c5e38
Contents?: true
Size: 863 Bytes
Versions: 23
Compression:
Stored size: 863 Bytes
Contents
# frozen_string_literal: true require "forwardable" require "open3" require "logger" module Pragmater module CLI # A simple delegator for common shell functionality. class Helper extend Forwardable LOGGER = Logger.new STDOUT, formatter: ( proc do |_severity, _datetime, _program_name, message| "#{message}\n" end ) delegate %i[info error fatal debug unknown] => :logger def initialize commander: Open3, logger: LOGGER @commander = commander @logger = logger end def run command commander.capture3 command end def warn message logger.warn message end private attr_reader :commander, :logger end end end
Version data entries
23 entries across 23 versions & 1 rubygems