Method: NicInfo::Main#show_helpful_messages

Defined in:
lib/nicinfo/nicinfo_main.rb

#show_helpful_messages(json_data, data_tree) ⇒ Object



1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
# File 'lib/nicinfo/nicinfo_main.rb', line 1086

def show_helpful_messages json_data, data_tree
  arg = @config.options.argv[0]
  case @config.options.query_type
    when QueryType::BY_IP4_ADDR
      @config.logger.mesg("Use \"nicinfo -r #{arg}\" to see reverse DNS information.");
    when QueryType::BY_IP6_ADDR
      @config.logger.mesg("Use \"nicinfo -r #{arg}\" to see reverse DNS information.");
    when QueryType::BY_AS_NUMBER
      @config.logger.mesg("Use \"nicinfo #{arg}\" or \"nicinfo as#{arg}\" for autnums.");
  end
  unless data_tree.empty?
    @config.logger.mesg("Use \"nicinfo 1=\" to show #{data_tree.roots.first}")
    unless data_tree.roots.first.empty?
      children = data_tree.roots.first.children
      @config.logger.mesg("Use \"nicinfo 1.1=\" to show #{children.first}") if children.first.rest_ref
      if children.first != children.last
        len = children.length
        @config.logger.mesg("Use \"nicinfo 1.#{len}=\" to show #{children.last}") if children.last.rest_ref
      end
    end
  end
  self_link = NicInfo.get_self_link( NicInfo.get_links( json_data, @config ) )
  @config.logger.mesg("Use \"nicinfo #{self_link}\" to directly query this resource in the future.") if self_link and @config.options.externally_queriable
  @config.logger.mesg('Use "nicinfo -h" for help.')
end