From 9459442b55c13bcb551e60fc7cdd885d5d748785 Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Thu, 7 May 2020 02:53:43 +0100 Subject: [PATCH] get a very rough prototype set-up. --- cheatsheet.md | 25 +++++++++++++++++++++++++ main.py | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 cheatsheet.md create mode 100644 main.py diff --git a/cheatsheet.md b/cheatsheet.md new file mode 100644 index 0000000..d6df26d --- /dev/null +++ b/cheatsheet.md @@ -0,0 +1,25 @@ +# Cheatsheet + +Here is a collection of shortcuts you are trying to learn. + +## Emacs + +- `**ctrl-c e**`: Does something fancy. +- **m-x c e l p**: Exports .org file to .pdf. + +## Custom Global Shortcuts + +`num-4`: Opens Emacs at tasks.org. + +`num-5`: Pushes published files to abbether. + +`num-6`: Opens this cheatsheet. + +## Block code + +```python +from rich.console import Console + +console = Console() +``` + diff --git a/main.py b/main.py new file mode 100644 index 0000000..a474233 --- /dev/null +++ b/main.py @@ -0,0 +1,41 @@ +import argparse +from rich.console import Console +from rich.markdown import Markdown +from rich.table import Column, Table + + +def parse_arguments(): + parser = argparse.ArgumentParser( + "Displays a nicely formatted cheatsheet of") + parser.add_argument("-a", "--append", + help="Append a shortcut to your collection using Markdown.") + args = parser.parse_args() + return args + + +def display_file(): + with open("cheatsheet.md") as cheats: + markdown = Markdown(cheats.read()) + console = Console() + console.print(markdown) + + +def append_to_file(data): + # This is not implemented. + x = 0 + + +def main(): + args = parse_arguments() + a = args.append + # print(args) + if a is None: + display_file() + else: + print("Appending to file...") + append_to_file(args.append) + x = 4 + + +if __name__ == "__main__": + main()