Sha256: 5bd77f2707f80ce421403c5f15b9d372f9419dbb1bf1ce829dda414ad6e888e4

Contents?: true

Size: 535 Bytes

Versions: 7

Compression:

Stored size: 535 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift __dir__ + "/../../lib"
require "dry/cli"

module Infinites
  extend Dry::CLI::Registry

  class Reader < Dry::CLI::Command
    def call(*)
      while (a = $stdin.gets)
        puts "From stdin: #{a}"
        sleep 2
      end
    end
  end

  class Writer < Dry::CLI::Command
    def call(*)
      (0..Float::INFINITY).each do |i|
        $stdout.puts i
      end
    end
  end

  register "reader", Reader
  register "writer", Writer
end

Dry.CLI(Infinites).call

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rfix-3.0.1 vendor/dry-cli/spec/support/fixtures/infinites
rfix-3.0.0 vendor/dry-cli/spec/support/fixtures/infinites
rfix-2.0.4 vendor/dry-cli/spec/support/fixtures/infinites
rfix-2.0.3 vendor/dry-cli/spec/support/fixtures/infinites
rfix-2.0.2 vendor/dry-cli/spec/support/fixtures/infinites
rfix-2.0.1 vendor/dry-cli/spec/support/fixtures/infinites
rfix-2.0.0 vendor/dry-cli/spec/support/fixtures/infinites