Skip to content

Instantly share code, notes, and snippets.

@smetj
Created January 13, 2019 11:56
Show Gist options
  • Save smetj/f1f48fed39fcb68e75c87839953dfd48 to your computer and use it in GitHub Desktop.
Save smetj/f1f48fed39fcb68e75c87839953dfd48 to your computer and use it in GitHub Desktop.
Creating a CLI tool using TermFunk
#!/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