Sha256: e62c1260f47fe53818c87820d76ab5d3c245a1d6be9715348739765b63ffbed9

Contents?: true

Size: 567 Bytes

Versions: 1

Compression:

Stored size: 567 Bytes

Contents

# -*- ruby-indent-level: 2; -*-

require_relative "../lib/hysh"

def dpkg_installed1(package_names = nil)
  Hysh.out_lines ->{
    Hysh.pipe ['dpkg', '-l'],
      if package_names
	['egrep', "(#{package_names.join '|'})"]
      else
	['cat']
      end
  }
end

def dpkg_installed2(package_names = nil)
  Hysh.out_lines ->{
    Hysh.pipe ['dpkg', '-l'] {
      proc_line = if package_names
		    ->l{
		      if package_names.any? { |pkg|
			   l.index pkg
			 }
			l
		      end
		    }
		  else
		    ->l{ l }
		  end
      Hysh.filter_line &proc_line
    }
  }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hysh-0.0.1 test/dpkg_test.rb