Sha256: ef3926306ac99c315ab47e91f4ad571a6819cb193a35786c512d8a0437b9fde2
Contents?: true
Size: 954 Bytes
Versions: 5
Compression:
Stored size: 954 Bytes
Contents
#!/usr/bin/env ruby require 'spruz/go' include Spruz::GO require 'spruz/xt/secure_write' require 'tempfile' path_separator = RUBY_PLATFORM =~ /mswin32/ ? ';' : ':' path = (ENV['PATH'] || '').split(path_separator) path.map! { |part| File.expand_path(part) } $opt = go('e') case cmd = ARGV.shift when 'prefix', 'postfix' part = ARGV.shift or fail 'need a path part to prefix' part = File.expand_path(part) path.delete part if cmd == 'prefix' path.unshift part else path.push part end when 'edit' if path_argument = ARGV.first path = path_argument.split(path_separator) path.map! { |part| File.expand_path(part) } end path_file = File.join(Dir.tmpdir, "path_temp.#$$") File.secure_write path_file, path * "\n" system "edit -w #{path_file.inspect}" path = File.read(path_file).split(/\n/) path.map! { |part| File.expand_path(part) } end path.uniq! puts "#{'export ' if $opt['e']}PATH=#{path * path_separator}"
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
utils-0.0.21 | bin/path |
utils-0.0.20 | bin/path |
utils-0.0.19 | bin/path |
utils-0.0.18 | bin/path |
utils-0.0.17 | bin/path |