Liste des TLDs pour la France et ses DROM-COM (départements et régions d'outre-mer et collectivités d'outre-mer)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
Liste des TLDs pour la France et ses DROM-COM (départements et régions | |
d'outre-mer et collectivités d'outre-mer) | |
=end | |
require 'docopt' | |
TLDs = { | |
'bl' => 'Saint-Barthélemy', | |
'fr' => 'France', | |
'gf' => 'Guyane française', | |
'gp' => 'Guadeloupe', | |
'mf' => 'Saint-Martin (réservé, registre non assigné)', | |
'mq' => 'Martinique', | |
'nc' => 'Nouvelle-Calédonie', | |
'pf' => 'Polynésie française (avec l\'île de Clipperton)', | |
'pm' => 'Saint-Pierre-et-Miquelon', | |
're' => 'La Réunion', | |
'tf' => 'Terres australes et antarctiques françaises', | |
'wf' => 'Wallis-et-Futuna', | |
'yt' => 'Mayotte' | |
} | |
TLD_status = { | |
'bl' => 0, | |
'fr' => 2, | |
'gf' => 1, | |
'gp' => 1, | |
'mf' => 0, | |
'mq' => 1, | |
'nc' => 1, | |
'pf' => 1, | |
'pm' => 2, | |
're' => 2, | |
'tf' => 2, | |
'wf' => 2, | |
'yt' => 2 | |
} | |
STATUS = { | |
0 => 'réservé, registre non assigné', | |
1 => 'fortement restreint', | |
2 => 'faiblement restreint' | |
} | |
doc = <<~DOCOPT | |
#{__FILE__} | |
Usage: | |
#{__FILE__} [options] <domain> | |
#{__FILE__} -h | --help | |
Options: | |
<domain> Domain to search for | |
-a, --all Display all TLDs (even reserved and restricted) | |
-i, --info Display TLD information | |
-h, --help Show this screen | |
Examples: | |
#{__FILE__} company | |
DOCOPT | |
if __FILE__ == $0 | |
args = Docopt.docopt(doc) | |
TLDs.each do |tk, tv| | |
if TLD_status[tk] == 2 || args['--all'] | |
print "#{args['<domain>']}.#{tk}" | |
puts args['--info'] ? "; #{tv.ljust(50)}; #{STATUS[TLD_status[tk]]}" : '' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment