Sha256: bc5e5c0cb17da096b95a6e46a6e6823e00e1efed51181aec7875e2c3a07d0e39

Contents?: true

Size: 1.51 KB

Versions: 59

Compression:

Stored size: 1.51 KB

Contents

#!/usr/bin/env ruby

# For security reasons, ensure that '.' is not on the load path
# This is primarily for 1.8.7 since 1.9.2+ doesn't put '.' on the load path
$LOAD_PATH.delete '.'

require 'mcollective'

# assume everything will all be fine
exitcode = 0

Version = MCollective.version
known_applications = MCollective::Applications.list

# links from mc-ping to mc will result in ping being run
if $0 =~ /mc\-([a-zA-Z\-_\.]+)$/
  app_name = $1
else
  app_name = ARGV.first
  ARGV.delete_at(0)

  # it may be a config option rather than an application name.  In this
  # case pretend we had no application name
  if app_name =~ /^--/
    app_name = nil
  end
end

if known_applications.include?(app_name)
  # make sure the various options classes shows the right help etc
  $0 = app_name

  MCollective::Applications.run(app_name)
else
  puts "The Marionette Collective version #{MCollective.version}"
  puts

  if app_name
    puts "Unknown command '#{app_name}', searched for applications in:"
    puts
    puts MCollective::Config.instance.libdir.map { |path| "   #{path}\n" }
    puts

    # exit with an error as we didn't find a command
    exitcode = 1
  else
    puts "usage: #{$0} command <options>"
    puts
  end

  puts "Known commands:"
  puts

  known_applications.sort.uniq.in_groups_of(3) do |apps|
    puts "   %-20s %-20s %-20s" % [apps[0], apps[1], apps[2]]
  end

  puts
  puts "Type '#{$0} help' for a detailed list of commands and '#{$0} help command'"
  puts "to get detailed help for a command"
  puts
end

exit exitcode

Version data entries

59 entries across 59 versions & 2 rubygems

Version Path
choria-mcorpc-support-2.26.5 bin/mco
choria-mcorpc-support-2.26.4 bin/mco
choria-mcorpc-support-2.26.3 bin/mco
choria-mcorpc-support-2.26.2 bin/mco
choria-mcorpc-support-2.26.1 bin/mco
choria-mcorpc-support-2.26.0 bin/mco
choria-mcorpc-support-2.25.3 bin/mco
choria-mcorpc-support-2.25.2 bin/mco
choria-mcorpc-support-2.25.1 bin/mco
choria-mcorpc-support-2.25.0 bin/mco
choria-mcorpc-support-2.24.4 bin/mco
choria-mcorpc-support-2.24.3 bin/mco
choria-mcorpc-support-2.24.2 bin/mco
choria-mcorpc-support-2.24.1 bin/mco
choria-mcorpc-support-2.24.0 bin/mco
choria-mcorpc-support-2.23.3 bin/mco
choria-mcorpc-support-2.23.2 bin/mco
choria-mcorpc-support-2.23.1 bin/mco
choria-mcorpc-support-2.23.0 bin/mco
choria-mcorpc-support-2.23.0.pre bin/mco