Created
August 4, 2022 11:49
-
-
Save beucismis/342702d6b57aacf95d0c9ccd3deb85b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import inquirer | |
| EDITOR = os.environ["EDITOR"] | |
| NOTES_PATH = os.environ["NOTES_PATH"] | |
| questions = [ | |
| inquirer.List( | |
| "filename", | |
| message="Select file to edit", | |
| choices=[ | |
| file | |
| for file in os.listdir(NOTES_PATH) | |
| if os.path.isfile(os.path.join(NOTES_PATH, file)) | |
| ], | |
| ), | |
| ] | |
| answers = inquirer.prompt(questions) | |
| os.system( | |
| "{} {}".format( | |
| EDITOR, | |
| os.path.join(NOTES_PATH, answers["filename"]) | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment