Closed shvets92 closed 2 months ago
also I won't but I am allowed to merge this branch, so the branch protection rules may not be working
also these are the docs to the typer
cli library: https://typer.tiangolo.com/
I see more results now so I think this is working. I added the verbose flag too. If you didn't already know, you can either use the --help
flag or call the script with no args to show the help menu.
Feel free to merge when you're ready
also if you're looking into loggers I've had a good experience with loguru
for my work cli. It doesn't really require any boiler plate to setup and has colors built into the logs.
I just import like this: from loguru import logger as log
(because you don't "logger" messages you "log" them)
and then log like so:
log.info("informational message")
log.debug("detailed message")
log.warning("don't you touch those cookies young man")
log.error("everything is on fire, call your mother")
It takes in some ENV vars for setting the level if you want but if you want to "hook it up" to the verbose flag you can do something like this:
import sys
if verbose:
log.add(sys.stderr, level="DEBUG")
That's what I do at work but I think you might need to use sys.stdout
if you want to be able to pipe those logs to shell commands with the |
char
still need to update docs, tried running this
and got this as the output which seems short so need to make sure it's not broken and am too tired to do so right now
Should avoid invalid years though
Feel free to pull this down and try it though