Last active
December 19, 2018 02:01
-
-
Save cmatthewbrooks/b07d56cbad688578399e89cb65c40521 to your computer and use it in GitHub Desktop.
Script from the pyiocutils.iocargs asciinema example.
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 argparse | |
# Import from the pyiocutils package | |
from pyiocutils.ioc import Ioc as Ioc | |
from pyiocutils.iocargs import IocArgs as IocArgs | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser() | |
# Add an indicators argument that can take multiple elements | |
parser.add_argument( | |
'-i','--indicators', nargs='*', dest='indicators', default=[] | |
) | |
args = parser.parse_args() | |
# Use the IocArgs module that has different options | |
indicators = IocArgs.args_to_set(args.indicators) | |
# And check and see how things were parsed! | |
for indicator in indicators: | |
print indicator + ' is ' + Ioc.get_indicator_type(indicator) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment