mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
29 lines
517 B
Python
29 lines
517 B
Python
|
# -*- coding: utf-8 -*-
|
||
|
'''
|
||
|
Simple script to dump the contents of msgpack files to the terminal
|
||
|
'''
|
||
|
|
||
|
# Import python libs
|
||
|
import os
|
||
|
import sys
|
||
|
import pprint
|
||
|
|
||
|
# Import third party libs
|
||
|
import msgpack
|
||
|
|
||
|
|
||
|
def dump(path):
|
||
|
'''
|
||
|
Read in a path and dump the contents to the screen
|
||
|
'''
|
||
|
if not os.path.isfile(path):
|
||
|
print 'Not a file'
|
||
|
return
|
||
|
with open(path, 'rb') as fp_:
|
||
|
data = msgpack.loads(fp_.read())
|
||
|
pprint.pprint(data)
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
dump(sys.argv[1])
|