class RIPECLINER::CLI
Public Class Methods
new(params)
click to toggle source
# File lib/ripecliner/cli.rb, line 5 def initialize(params) @command = params[0] @argument = params[1] invoke_command end
print_help()
click to toggle source
# File lib/ripecliner/cli.rb, line 37 def self.print_help puts <<~HELP ripecliner is a CLI Downloader & Transformer for RIPE Routing Information Service Usage: bin/ripecliner -h/--help bin/ripecliner -v/--version bin/ripecliner command [argument] Examples: bin/ripecliner download <date> bin/ripecliner convert <file> Further information: https://github.com/defself/ripecliner HELP end
Public Instance Methods
invoke_command()
click to toggle source
# File lib/ripecliner/cli.rb, line 12 def invoke_command case @command when "download" dump = RIPECLINER::BGPDump.new dump.date = @argument dump.download when "convert" dump = RIPECLINER::BGPDump.new if @argument dump.file = @argument else raise ArgumentError.new("Please, specify dump file for converting / downloading.") end dump.convert when "-h", "--help" CLI.print_help when "-v", "--version" puts RIPECLINER::VERSION else raise ArgumentError.new("Unrecognized command") end end