Sha256: fbcbea804fc81b44306ab147d56d487ccd2aed7d3a399e089df508df7cf5d4b3

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

#!/usr/bin/ruby

if ARGV.include?('-h') || ARGV.include?('--help') || ARGV.length == 0
  puts 'after: the command to run things after an external process terminates'
  puts 'syntax: after [-q] [-l | --list] ([-p (pid1 | pid1,pid2,pid3)] | "command string to match") command to run after it and its args'
  puts '  -q : quiet mode (don\'t show output for when process ends)'
  puts '  --list : only list matches, don\'t actually wait for them'
  puts "  \"command string to match\" like ruby.exe or irb : match all processes by name and arguments"
  puts "  command to run with args: some other command to run on completion, like ls -l, no quotes needed."
  puts
  puts 'Examples:'
  puts
  puts 'after ruby ls -l          # run ls -l after all ruby processes exit'
  puts 'after ruby "ls -l"        # same'   
  puts 'after -l                  # list all running processes'
  puts 'after -l ruby             # list all running processes that have ruby in their executable name or arguments'
  puts "after irb \"ls | grep l\"   # complex command to run after irb terminates (runs $ ls | grep l)"
  puts "after -p 3704 ls          # run ls after process with PID 3704 terminates"
  puts "after -q -p 3704 ls       # run ls after PID 3704 terminates, don't output anything except the output of ls"
  puts "after -p 3704,4804 ls     # run ls after PIDS 3704, 4804 both terminate"
  exit
end

require 'after'

After.go

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
after-0.8.3 bin/after