Created
May 27, 2017 23:38
-
-
Save stan1y/e207d0bc773fb8348f4c1b4b5466bad0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 optparse | |
| import sys | |
| def populate_with_regex(expr): | |
| # return list of int ids | |
| return [1, 2, 3] | |
| def do_business_with_devices_list(lst): | |
| print("business: %s" % repr(lst)) | |
| def main(): | |
| parser = optparse.OptionParser() | |
| parser.add_option("--devices", action="append", type="int") | |
| parser.add_option("--device-regex", type="string") | |
| (options, args) = parser.parse_args() | |
| if options.devices_regex: | |
| options.devices = populate_with_regex(options.regex) | |
| do_business_with_devices_list(options.devices) | |
| if __name__ == '__main__': | |
| sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment