Created
January 13, 2019 11:56
-
-
Save smetj/f1f48fed39fcb68e75c87839953dfd48 to your computer and use it in GitHub Desktop.
Creating a CLI tool using TermFunk
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/env python | |
from termfunk import TermFunk | |
from termfunk import File | |
class Validate(TermFunk): | |
def __init__(self, description): | |
TermFunk.__init__(self, description, width=999) | |
def function_json(self, file=File()): | |
import json | |
with open(file, "r") as f: | |
json.load(f) | |
def function_yaml(self, file=File()): | |
import yaml | |
with open(file, "r") as f: | |
yaml.load(f) | |
def main(): | |
Validate("A collection of validation function.") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment