Skip to content

Instantly share code, notes, and snippets.

@cmatthewbrooks
Last active December 19, 2018 02:01
Show Gist options
  • Save cmatthewbrooks/b07d56cbad688578399e89cb65c40521 to your computer and use it in GitHub Desktop.
Save cmatthewbrooks/b07d56cbad688578399e89cb65c40521 to your computer and use it in GitHub Desktop.
Script from the pyiocutils.iocargs asciinema example.
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