Sha256: 790cd1537079db2ad71df974081de0661f89f4facd96894986ebfe9c4ef703e5

Contents?: true

Size: 1.35 KB

Versions: 13

Compression:

Stored size: 1.35 KB

Contents

#!/usr/bin/env ruby

require 'gli'

include GLI::App
subcommand_option_handling :normal
sort_help :manually
commands_from 'flapjack/cli'

program_desc 'Flexible monitoring notification routing system'

version Flapjack::VERSION

desc 'Configuration file to use'
default_value '/etc/flapjack/flapjack_config.yaml'
arg_name '/path/to/flapjack.yaml'
flag [:c,:config]

desc 'Environment to boot'
default_value 'production'
arg_name '<environment>'
flag [:n, :env, :environment]

accept Array do |value|
  value.split(/,/).map(&:strip)
end

pre do |global,command,options,args|
  FLAPJACK_ENV = ENV["FLAPJACK_ENV"] || global[:environment]
  true
end

post do |global,command,options,args|
end

on_error do |exception|
  # We've changed the commands to control the flapjack server.  If we detect
  # the user has tried one of the old commands, show them what they should
  # have used instead.
  SERVER_COMMANDS = %w(start stop restart reload status)
  message = exception.message
  input = message.split("'").last.downcase
  old_command = message.start_with?('Unknown command') && SERVER_COMMANDS.include?(input)
  if old_command
    puts exception.message
    puts "\nDid you mean: #{$PROGRAM_NAME} server #{input}?"
    puts "\nTry #{$PROGRAM_NAME} help"
  end
  # If this wasn't an old server command, return true to show the standard error dialog
  !old_command
end

exit run(ARGV)

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
flapjack-1.2.1 bin/flapjack
flapjack-1.2.1rc3 bin/flapjack
flapjack-1.2.1rc2 bin/flapjack
flapjack-1.2.1rc1 bin/flapjack
flapjack-1.2.0 bin/flapjack
flapjack-1.2.0rc2 bin/flapjack
flapjack-1.2.0rc1 bin/flapjack
flapjack-1.1.0 bin/flapjack
flapjack-1.0.0 bin/flapjack
flapjack-1.0.0rc6 bin/flapjack
flapjack-1.0.0rc5 bin/flapjack
flapjack-1.0.0rc3 bin/flapjack
flapjack-1.0.0rc2 bin/flapjack