diff options
Diffstat (limited to 'bin/dtas-sourceedit')
-rwxr-xr-x | bin/dtas-sourceedit | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bin/dtas-sourceedit b/bin/dtas-sourceedit index 9d329d7..3ce7945 100755 --- a/bin/dtas-sourceedit +++ b/bin/dtas-sourceedit @@ -18,6 +18,7 @@ tmp.binmode buf = c.req(%W(source cat)) abort(buf) if buf =~ /\AERR/ +orig = YAML.load(buf) tmp.write(buf << DTAS_DISCLAIMER) cmd = "#{editor} #{tmp.path}" @@ -32,8 +33,16 @@ if env = source["env"] end end +# remove deleted env +if orig_env = orig["env"] + env ||= {} + deleted_keys = orig_env.keys - env.keys + deleted_keys.each { |k| cmd << "env##{k}" } +end + %w(command).each do |field| - value = source[field] and cmd << "#{field}=#{value}" + value = source[field] + cmd << "#{field}=#{value}" end c.req_ok(cmd) |