Created
March 14, 2022 21:09
-
-
Save lewoudar/3705c0b6c3eae7f41e4aec50683ff0c8 to your computer and use it in GitHub Desktop.
Another example of click_params list type
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
import socket | |
import click | |
from click_params import DomainListParamType | |
@click.option( | |
'-d', '--domains', | |
prompt=True, | |
help='list of domain names separated by a space', | |
type=DomainListParamType(' ') | |
) | |
@click.command() | |
def cli(domains): | |
"""Give an ip address of the given domain names""" | |
for domain in domains: | |
click.echo(f'{domain} -> {socket.gethostbyname(domain)}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment