Last active
August 29, 2015 14:03
-
-
Save gregneagle/7ae4bc44a078142cb30f 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
#!/usr/bin/python | |
""" | |
Programmatically altering plists with Python, shooting to add support to ansible | |
""" | |
import optparse | |
import FoundationPlist | |
# from munkilib import FoundationPlist | |
p = optparse.OptionParser() | |
p.add_option('--file', '-f', help="File we're operating on") | |
p.add_option('--read', '-r', help='Checks value') | |
p.add_option('--write', '-w', help='Changes value') | |
p.add_option('--delete', '-d', help='Deletes value') | |
p.add_option('--value', '-v', help='Value') | |
options, arguments = p.parse_args() | |
def main(): | |
if options.file: | |
found_plist = FoundationPlist.readPlist(options.file) | |
if options.read: | |
print found_plist[options.read] | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment