-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ft option #20
Ft option #20
Conversation
You can now pass an optional flag with the file extension of our preference in the format "txt" (no dot).
Thank you for the PR! I will review and request a couple of small changes. Hopefully, that is ok with you. Looking forward to merging this in. |
Apologies if there are errors etc. Is my first pull!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. My main request is that we add support for specifying multiple file extensions. Typer has good support for that and I linked some documentation. Let me know if you have any issues making those changes but after that it should be good to go.
@@ -48,6 +48,11 @@ def convertMarkdown( | |||
"--prefix", | |||
help="Can be used to make your markdown decks part of a single subdeck. Anki uses `::` to indicate sub decks. `markdown-decks::` could be used to make all generated decks part of a single root deck `markdown-decks`", | |||
), | |||
filetype: str = typer.Option( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change the name of this parameter to extension
with a short option of --ext
? That would match the API exposed by other similar programs. For example, see eslint.
Can we allow the user to pass multiple extensions instead of just a single string? See the page multiple cli options in the typer docs for instructions on how to do this. We would have to change the default value to ["md"]
and the type to Optional[List[str]]
.
filetype: str = typer.Option( | ||
"md", | ||
"--ft", | ||
help="Can be use to specify the use of other filetypes. Specify just the fine extension, e.g., 'txt'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the help text to something like.
"This option lets you specify which file extensions markdown-anki-decks will use when searching for files to convert into Anki decks. By default, it uses 'md' as the only file extension."
"""Check if a file is a markdown file.""" | ||
# TODO(lukemurray): parameterize markdown extensions? | ||
return file.endswith(".md") | ||
def is_correct_filetype(file, filetype: str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change is_correct_filetype
to has_file_extension
.
change the filetype
parameter to extension
or extensions
(up to you). Also the second parameter will be a list once you make the changes from above so you'll have to change some of the types and logic here.
Welp. Not sure what happened. Looks like you deleted your branch and closed the PR. This is close enough that I should be able to merge these changes later myself. But please reopen and send another PR with the requested changes if you already have the code. |
If you're having trouble just let me know and I can take it from here. Otherwise I don't want to repeat work you've already done! |
Sorry about that. Deleted my branch after merge with my master out of habit. Did't know it would close the pull. The new pull should be all good boss |
Closes #18