{"id":15017318,"url":"https://github.com/laurencewarne/curses-questions","last_synced_at":"2025-04-12T11:42:19.698Z","repository":{"id":62566018,"uuid":"191403944","full_name":"LaurenceWarne/curses-questions","owner":"LaurenceWarne","description":"Test yourself without leaving your terminal","archived":false,"fork":false,"pushed_at":"2024-03-20T15:45:45.000Z","size":31,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T03:07:06.085Z","etag":null,"topics":["anki","bash","curses","linux","python3","terminal"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LaurenceWarne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-11T15:50:26.000Z","updated_at":"2020-12-06T23:59:51.000Z","dependencies_parsed_at":"2024-11-14T20:11:30.324Z","dependency_job_id":null,"html_url":"https://github.com/LaurenceWarne/curses-questions","commit_stats":{"total_commits":30,"total_committers":1,"mean_commits":30.0,"dds":0.0,"last_synced_commit":"70c70a11fba1070fe1be1f8161b21c0bf3efe272"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaurenceWarne%2Fcurses-questions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaurenceWarne%2Fcurses-questions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaurenceWarne%2Fcurses-questions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaurenceWarne%2Fcurses-questions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LaurenceWarne","download_url":"https://codeload.github.com/LaurenceWarne/curses-questions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248563719,"owners_count":21125339,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anki","bash","curses","linux","python3","terminal"],"created_at":"2024-09-24T19:50:18.089Z","updated_at":"2025-04-12T11:42:19.673Z","avatar_url":"https://github.com/LaurenceWarne.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Curses Questions\n\nA simple script which uses curses to create a nice TUI for asking questions.\n\n\nTable of Contents\n=================\n\n   * [Curses Questions](#curses-questions)\n      * [Demo](#demo)\n      * [Installation](#installation)\n      * [Usage](#usage)\n      * [Anki .apkg Compatibility](#anki-apkg-compatibility)\n      * [Recipes](#recipes)\n\n## Demo\n\n[![asciicast](https://asciinema.org/a/VM1Gx7rwbmdSP1vFbd5HecPtx.svg)](https://asciinema.org/a/VM1Gx7rwbmdSP1vFbd5HecPtx)\n\n## Installation\n\nRequires python 3.\n\n```\n# Installs locally\n$ pip3 install curses-questions --user\n```\n\nOr install from source:\n\n```\n$ git clone https://github.com/LaurenceWarne/curses-questions.git \u0026\u0026 cd curses-questions\n# Installs locally\n$ python3 setup.py install --user\n```\n\n## Usage\n\n```\nusage: curses-questions [-h] [-d DELIMITER] [-p PRECEDE] [-c CHOICES | -pa] -n\n                        QUESTIONS | -a | -e]\n                        [infile]\n\nAnswer questions from a text file using the number keys. Questions and their\nanswers should be on the same line and split by a common delimeter. The answer\nchoices displayed by the program for a given question are sampled randomly\nfrom other questions in the input file (in addition to the correct answer).\n\npositional arguments:\n  infile                name of file to read questions from, defaults to stdin\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -d DELIMITER, --delimiter DELIMITER\n                        delimiter in input lines which divide the question and\n                        answer, default is tab\n  -p PRECEDE, --precede PRECEDE\n                        precede all question strings with this string\n  -c CHOICES, --choices CHOICES\n                        number of answers to choose from per question, default\n                        is 3\n  -pa, --preset-answers\n                        using this option will replace the programs default\n                        behaviour of obtaining possible answers for a question\n                        by sampling answers to other questions. Instead, the\n                        program will interpret input lines as a question\n                        followed by one or more answers; the question/answers\n                        being seperated by the --delimiter option and the\n                        question always being taken as the string before the\n                        first occurrence of the delimiter. The correct answer\n                        will be taken as the string after.\n  -n QUESTIONS, --questions QUESTIONS\n                        number of questions to answer (no duplicates). If this\n                        is greater than the number of questions in the file,\n                        all the questions are asked in a random order.\n  -a, --all             Ask all questions in the input file, preserving their\n                        order\n  -e, --endless         keep asking questions until user terminates program\n```\n\n## Anki .apkg Compatibility\n\nYou can use the ```curses-anki``` script to convert anki .apkg files to a format usable by ```curses-questions```:\n```\n$ curses-anki my-file.apkg --fields 1 3 | curses-questions\n```\nHere the ```--fields``` flag corresponds to text separated by the character ```\\x1f``` in the ```flds``` column of the ```notes``` table in the database extracted from the .apkg file (you can read more about the .apkg file format [here](https://decks.fandom.com/wiki/Anki_APKG_format_documentation)). ie the values of 1 3 above with the flds column ```hi\\x1fthere\\x1fsir``` will return ```hi``` and ```sir```.\n\nThe fields typically correspond to rows specified in a deck intro. Taking as a working example [this](https://ankiweb.net/shared/info/685421036) deck on works of art, the command:\n```\n$ curses-anki Great_Works_of_Art.apkg -f 2 3\n```\nWill print ```AUTHOR        PAINTING```(tab separated) for each note. and the command:\n```\n$ curses-anki Great_Works_of_Art.apkg -f 3 6\n```\nWill print ```PAINTING        PERIOD``` for each note.\n\nWithout the ```--fields``` option the script will guess appropriate fields by looking at their content.\n\nNote using this script will create a ```collection.anki2``` file in your working directory.\n\n\n## Recipes\n\nTest yourself on elements and their symbols:\n```\n$ wget https://raw.githubusercontent.com/andrejewski/periodic-table/master/data.csv -O elements.csv \u0026\u0026 cut -d \",\" -f 2,3 elements.csv | curses-questions -d \",\" -e -c 5\n```\n\nAmerican presidents and years they were in office:\n```\n$ wget https://raw.githubusercontent.com/m0rt1m3r/US-Presidents/master/USPresidents.csv \u0026\u0026 cut -d \",\" -f 2,4 USPresidents.csv | curses-questions -d \",\" -c 5 -p \"Which of these dates marks the starting term of \"\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaurencewarne%2Fcurses-questions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaurencewarne%2Fcurses-questions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaurencewarne%2Fcurses-questions/lists"}