Created
February 11, 2016 00:48
-
-
Save Resisty/3e2ceb03ecee18cdc90a to your computer and use it in GitHub Desktop.
Yam lint
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
#!/usr/bin/python | |
import sys | |
try: | |
import yaml | |
except: | |
print 'You must first install pyyaml: `pip install pyyaml`' | |
sys.exit(1) | |
from argparse import ArgumentParser | |
def main(): | |
parser = ArgumentParser('Yam Lint. Mmm.') | |
parser.add_argument('yamlfile', help = 'The YAML file which needs linting.') | |
args = parser.parse_args() | |
msg = '{} is {}yaml{}' | |
try: | |
with open(args.yamlfile, 'r') as fptr: | |
yamlint = yaml.load(fptr.read()) | |
except: | |
print msg.format(args.yamlfile, 'not ', '.') | |
return | |
print msg.format(args.yamlfile, '', '!') | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment