I am writing a program in python to search my .bib-files for LaTeX with several flags. For that purpose I am using the argparse
package for python.
parser = argparse.ArgumentParser(description=description_string, usage=usage_string, add_help=True)
parser.add_argument("-f", "--file", type=str, help=file_help_text)
parser.add_argument("-s", "--signifier", type=str, action='append',help=signifier_help_text)
parser.add_argument("-a", "--attribute", type=str, help=attribute_help_text)
parser.add_argument("-q", "--query", type=str, help=query_help_text)
args = parser.parse_args()
Since I want to be able to use the program in the terminal, want to be able to pipe information from other processes to the script. Specifically, I want any string piped to the script to be used as the input to the -q / --query option of my script.
I have already read the following question and it did not solve my problem: Bash pipe to python
How can I control to which input-flag the piped strings go? Is there a package for it? It would really make my script more useful if I could pip into it.