Sha256: fe2c8909f3f6d3553886a354681708052d2341efd8e355387c45646cd83f0f16

Contents?: true

Size: 597 Bytes

Versions: 1

Compression:

Stored size: 597 Bytes

Contents

# frozen_string_literal: true

##
# Call +extend+ Cartage::CLI to add the commands defined in the block.
Cartage::CLI.extend do
  desc "Echo the provided text"
  arg :TEXT, :multiple
  command "echo" do |echo|
    echo.hide!
    echo.desc "Suppress newlines"
    echo.switch [:c, "no-newlines"], negatable: false
    echo.action do |_g, options, args|
      unless cartage.quiet
        message = args.join(" ")
        if options["no-newlines"] || cartage.config(for_command: "echo").no_newlines
          puts message
        else
          print message
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cartage-2.2.1 lib/cartage/commands/echo.rb