Tools like dnsgen works with this both type of options:
Without any argument:
cat domains.txt | dnsgen - | someotherprogram
With argument:
dnsgen -w wordlist filename.txt
Can I make my program use - without argument i.e. dnsgen - style. Lets say my code is this and it can receive data from both stdin and wordlist
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-w', '--wordlist', help="Wordlist")
argv = parser.parse_args()
my_awesome_function(argv.wordlist)
So, my code reads only from wordlist. How can I make this both by wordlist and by stdin using - argument style?