Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command: Show fluentd version for debug purpose #1839

Merged
merged 2 commits into from
Feb 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/fluent/command/binlog_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
require 'fluent/plugin'
require 'fluent/config/element'
require 'fluent/engine'
require 'fluent/version'

class FluentBinlogReader
SUBCOMMAND = %w(cat head formats)
Expand Down Expand Up @@ -49,7 +50,14 @@ def call

def command
command = @argv.shift
if !command || !SUBCOMMAND.include?(command)
if command
if command == '--version'
puts "#{File.basename($PROGRAM_NAME)} #{Fluent::VERSION}"
exit 0
elsif !SUBCOMMAND.include?(command)
usage "'#{command}' is not supported: Required subcommand : #{SUBCOMMAND.join(' | ')}"
end
else
usage "Required subcommand : #{SUBCOMMAND.join(' | ')}"
end

Expand All @@ -70,6 +78,7 @@ def initialize(argv = ARGV)

@options = { plugin: [] }
@opt_parser = OptionParser.new do |opt|
opt.version = Fluent::VERSION
opt.separator 'Options:'

opt.on('-p DIR', '--plugin', 'add library directory path') do |v|
Expand Down
2 changes: 2 additions & 0 deletions lib/fluent/command/ca_generate.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'openssl'
require 'optparse'
require 'fileutils'
require 'fluent/version'

module Fluent
class CaGenerate
Expand Down Expand Up @@ -145,6 +146,7 @@ def self.generate_self_signed_server_pair(opts={})

def configure_option_parser
@opt_parser.banner = HELP_TEXT
@opt_parser.version = Fluent::VERSION

@opt_parser.on('--key-length [KEY_LENGTH]',
"configure key length. (default: #{DEFAULT_OPTIONS[:private_key_length]})") do |v|
Expand Down
2 changes: 2 additions & 0 deletions lib/fluent/command/cat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
require 'fluent/env'
require 'fluent/time'
require 'fluent/msgpack_factory'
require 'fluent/version'

op = OptionParser.new

op.banner += " <tag>"
op.version = Fluent::VERSION

port = 24224
host = '127.0.0.1'
Expand Down
2 changes: 2 additions & 0 deletions lib/fluent/command/plugin_config_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
require "fluent/engine"
require "fluent/system_config"
require "fluent/config/element"
require 'fluent/version'

class FluentPluginConfigFormatter

Expand Down Expand Up @@ -210,6 +211,7 @@ def usage(message = nil)

def prepare_option_parser
@parser = OptionParser.new
@parser.version = Fluent::VERSION
@parser.banner = <<BANNER
Usage: #{$0} [options] <type> <name>

Expand Down
2 changes: 2 additions & 0 deletions lib/fluent/command/plugin_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
require "open-uri"

require "fluent/registry"
require 'fluent/version'

class FluentPluginGenerator
attr_reader :type, :name
Expand Down Expand Up @@ -91,6 +92,7 @@ def file(source, dest)

def prepare_parser
@parser = OptionParser.new
@parser.version = Fluent::VERSION
@parser.banner = <<BANNER
Usage: fluent-plugin-generate [options] <type> <name>

Expand Down