I have the below python snippet
@click.argument('file',type=click.Path(exists=True))
The above command read from a file in the below format
python3 code.py file.txt
The same file is processed using a function
def get_domains(domain_names_file):
with open(domain_names_file) as f:
domains = f.readlines()
return domains
domains = get_domains(file)
I dont want to read it from file , I want to provide a domain as an argument while executing in terminal , the command will be
python3 code.py example.com
How should I rewrite the code .
Python Version : 3.8.2
typefrom the argument declaration. See docs