Sha256: fb4f2ce7d393053204c1bb43e7a37f696cd56b7ae36c406ce55b9135bb33518a
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
#!/usr/bin/env ruby # Copyright (C) 2013-2014, Eric Wong <e@80x24.org> 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: #$?" sink = YAML.load(File.read(tmp.path)) 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.9.0 | bin/dtas-sinkedit |
dtas-0.8.0 | bin/dtas-sinkedit |