Skip to content

Instantly share code, notes, and snippets.

@lewoudar
Created March 14, 2022 21:09
Show Gist options
  • Save lewoudar/3705c0b6c3eae7f41e4aec50683ff0c8 to your computer and use it in GitHub Desktop.
Save lewoudar/3705c0b6c3eae7f41e4aec50683ff0c8 to your computer and use it in GitHub Desktop.
Another example of click_params list type
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