ps_f 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/bin/ps_f +11 -7
  2. metadata +3 -3
data/bin/ps_f CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'optparse'
3
- Version = "0.1.5"
3
+ Version = '0.1.6'
4
4
 
5
5
  wide = false
6
6
  opt = OptionParser.new
@@ -48,12 +48,16 @@ def asm(tree, roots, pre_prefix, cmd_list, basename_only)
48
48
  list.sort_by {|a, b| a[0] }.each_with_index do |pid_cmd, i|
49
49
  pid, command = pid_cmd
50
50
 
51
- if basename_only
52
- head, tail = command.split(/ -/, 2)
53
- pos = head.rindex('/')
54
- pos = pos ? pos + 1 : 0
55
- command = head[pos..-1]
56
- command += ' -' + tail if tail
51
+ if basename_only and %r|\A/| =~ command
52
+ path_list = command.split(' ')
53
+ rest = []
54
+
55
+ until File.exist?(path_list.join(' ')) or path_list.empty?
56
+ rest << path_list.pop
57
+ end
58
+
59
+ command = File.basename(path_list.join(' '))
60
+ command << (' ' + rest.join(' ')) unless rest.empty?
57
61
  end
58
62
 
59
63
  cmd_list << [pid, pre_prefix + ' \_ ' + command]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ps_f
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - winebarrel