A Python 3 console program which displays a personal collection of shortcuts. It, also, has a feature to append new shortcuts to your collection via the Command Line Interface (C.L.I.). or manually editing the shortcuts file (a markdown file).
https://www.craigoates.net/Software/project/18
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
895 B
42 lines
895 B
4 years ago
|
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()
|