Sha256: 1e820a8e57a3a751167cdf01930a7ed09e687c27fe823d1e8222683e1098b80b

Contents?: true

Size: 1017 Bytes

Versions: 19

Compression:

Stored size: 1017 Bytes

Contents

#!/usr/bin/env ruby

require 'scout-gear'

$0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands

options = SOPT.setup <<EOF

Creates a one work comman alias.

$ #{$0} <alias> [<options>] [<othercmd>]*

The other commands might include options. But beware the some might reach the alias if they where consumed
earlier, like --dev or --log. Edit #{Scout.ect.cmd_alias.find} to fine tune.

-h--help Print this help
EOF
if options[:help]
  if defined? scout_usage
    scout_usage 
  else
    puts SOPT.doc
  end
  exit 0
end

cmd, *rest = ARGV

aliases ||= Scout.etc.cmd_alias.exists? ? Scout.etc.cmd_alias.yaml : {}

if cmd.nil?
  aliases.each do |name, parts|
    parts = parts.collect{|p|
      p =~ /^[\w:_\/-]*$/ ? p : "'" << p << "'"
    }
    puts [Log.color(:magenta, name), parts * " "] * ": "
  end
  exit 0
end

if rest.empty?
  aliases.delete cmd
else
  aliases[cmd] = rest
end

Open.write(Scout.etc.cmd_alias.find,(aliases.to_yaml))

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
scout-gear-10.7.3 scout_commands/alias
scout-gear-10.7.2 scout_commands/alias
scout-gear-10.7.1 scout_commands/alias
scout-gear-10.7.0 scout_commands/alias
scout-gear-10.4.0 scout_commands/alias
scout-gear-10.3.0 scout_commands/alias
scout-gear-10.2.0 scout_commands/alias
scout-gear-10.1.0 scout_commands/alias
scout-gear-10.0.1 scout_commands/alias
scout-gear-9.1.0 scout_commands/alias
scout-gear-9.0.0 scout_commands/alias
scout-gear-8.1.0 scout_commands/alias
scout-gear-8.0.0 scout_commands/alias
scout-gear-7.3.0 scout_commands/alias
scout-gear-7.2.0 scout_commands/alias
scout-gear-7.1.0 scout_commands/alias
scout-gear-6.0.0 scout_commands/alias
scout-gear-5.2.0 scout_commands/alias
scout-gear-5.1.1 scout_commands/alias