Sha256: 927113f81698ecdbb502abc5d697b6a4bc630f90f8ad26d94189223c33123f46
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
#!/usr/bin/env ruby # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require 'dtas/edit_client' include DTAS::EditClient c = client_socket sinks = c.req('sink ls') || "(unknown)" usage = "Usage: #{DTAS_PROGNAME} SINKNAME\n" \ "available SINKNAME values: #{sinks}" ARGV.size == 1 or abort usage name = ARGV[0] tmp = tmpyaml buf = c.req(%W(sink cat #{name})) abort(buf) if buf =~ /\AERR/ orig = YAML.load(buf) tmp.write(buf << DTAS_DISCLAIMER) cmd = "#{editor} #{tmp.path}" system(cmd) or abort "#{cmd} failed: #$?" tmp.rewind sink = YAML.load(tmp.read) cmd = %W(sink ed #{name}) update_cmd_env(cmd, orig, sink) # both of these default to false %w(nonblock active).each do |field| cmd << "#{field}=#{sink[field] ? 'true' : 'false'}" end %w(prio pipe_size).each do |field| value = sink[field] and cmd << "#{field}=#{value}" end # nil OK %w(command).each do |field| cmd << "#{field}=#{sink[field]}" end c.req_ok(cmd)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dtas-0.4.0 | bin/dtas-sinkedit |
dtas-0.3.0 | bin/dtas-sinkedit |