]> git.armaanb.net Git - lightcards.git/commitdiff
First commit
authorArmaan Bhojwani <me@armaanb.net>
Mon, 25 Jan 2021 03:24:22 +0000 (22:24 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Mon, 25 Jan 2021 03:24:22 +0000 (22:24 -0500)
Create shell for program

LICENSE [new file with mode: 0644]
Makefile [new file with mode: 0644]
README.md [new file with mode: 0644]
contrib/example.md [new file with mode: 0644]
contrib/manconvert [new file with mode: 0755]
lightcards.py [new file with mode: 0755]
man/lightcards.1.md [new file with mode: 0644]
requirements.txt [new file with mode: 0644]

diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..e1300da
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+Lightcards - Simple flashcards in the terminal
+Copyright © 2021 Armaan Bhojwani <me@armaanb.net>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..b6b6727
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,19 @@
+.DEFAULT_GOAL := install
+
+prep:
+       mkdir -p /usr/local/bin
+       mkdir -p /usr/local/man/man1
+
+install:
+       make prep
+       mkdir -p /usr/local/share/lightcards/
+       cp lightcards.py /usr/local/bin/lightcards
+       cp man/lightcards.1 /usr/local/man/man1/
+
+uninstall:
+       rm /usr/local/bin/lightcards
+       rm /usr/local/man/man1/lightcards.1
+
+reinstall:
+       make uninstall
+       make install
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..0a1b5dc
--- /dev/null
+++ b/README.md
@@ -0,0 +1,5 @@
+# lightcards
+Lightcards is a simple terminal program for creating flashcards from a markdown table
+
+## License
+Copyright Armaan Bhojwani 2021, MIT license
diff --git a/contrib/example.md b/contrib/example.md
new file mode 100644 (file)
index 0000000..a6213bd
--- /dev/null
@@ -0,0 +1,6 @@
+| Side 1                  | Side 2                |
+|-------------------------|-----------------------|
+| This is a front side    | This is a back side   |
+| Card 2                  | Card 2b               |
+| Random data random data | Answer to random data |
+| 42                      | no!                   |
diff --git a/contrib/manconvert b/contrib/manconvert
new file mode 100755 (executable)
index 0000000..4fad1cb
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+pandoc $1 -s -t man -o $(echo $1 | cut -d '.' -f -2)
diff --git a/lightcards.py b/lightcards.py
new file mode 100755 (executable)
index 0000000..191afcd
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+# Simple markdown flashcards utility
+# Armaan Bhojwani 2021
+
+import argparse
+import sys
+from bs4 import BeautifulSoup
+from blessings import Terminal
+import markdown
+
+
+def parse_args():
+    parser = argparse.ArgumentParser(description="Simple terminal flashcards")
+    parser.add_argument("inp", metavar="inp", type=str, nargs=1)
+    return parser.parse_args()
+
+def main():
+    pass
+
+if __name__ == "__main__":
+    args = parse_args()
+    t = Terminal()
+    main()
diff --git a/man/lightcards.1.md b/man/lightcards.1.md
new file mode 100644 (file)
index 0000000..42259ec
--- /dev/null
@@ -0,0 +1,35 @@
+% lightcards(1) 0.0.0
+% Armaan Bhojwani
+% January 2021
+
+# NAME
+Lightcards - simple terminal flashcards.
+
+# SYNOPSIS
+lightcards [[options]] [[input file]]
+
+# DESCRIPTION
+**lightcards** is a Python script that reads data from a markdown table, and creates flashcards from them.
+
+# OPTIONS
+**-h**, **--help**
+: Show a help message and exit
+
+**-v**, **--version**
+: Print version
+
+# EXIT VALUES
+**0**
+: Success
+
+**1**
+: Cannot find input file
+
+**2**
+: Invalid option
+
+# BUGS, PATCHES
+https://lists.sr.ht/~armaan/public-inbox
+
+# COPYRIGHT
+Copyright 2021 Armaan Bhojwani <me@armaanb.net>. MIT License
diff --git a/requirements.txt b/requirements.txt
new file mode 100644 (file)
index 0000000..aaa9d9d
--- /dev/null
@@ -0,0 +1,3 @@
+beautifulsoup4==4.9.3
+blessings==1.7
+markdown==3.3.3