WPI: CLI-argument-#1 #17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "WIP-CLI-argument-#1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
changed arguments parsing to argparse use
issue fix #1
Thanks @remace07!
I am a bit confused why the the "Fix HLS..." commit shows as part of that branch. I am not familiar with Gitea and therfore I find it difficult to see the diff against
stablewithout seeing all those changes as well. Maybe @freezed can share some git wizardry here :)In terms of code structure, how about keeping the "cli" things in
__main__.pyif they do not need testing, and the rest (like the parser) in acli.pymodule ?Let's talk about it, for my part I prefer the separation of concerns rather than one class <=> one module.
Also, more command line arguments are most likely going/comming with #11
Also I will push the creation of
tests/__init__.pyand the pytest configuration in thepyproject.tomlbefore we push this.Just so testing it has it's own moment of glory in history.
I just saw that you used
unittestfor testing. Thats fine to start I guess... it has been ages that I did not code any python unittests (or any python actually).for the commit "fix HLS", it comes from stable from which I did the branch. I think that's why it's still here. to be fair, i'm not a git wizard at all, I don't know why it appears if it's not normal.
to me, the "CLI parsing" is an independant concern on its own (needing a single class/object though). this is why there is a separate module, CliParser, with a class declaration(CLIParser), which is used only once in main (it replaces exactly what You
did before with
but it will be easier to change prototypes later with this, as you mentionned in more recent issues, where You need more arguments/options.
what I did, is pretty much what you say (as much as I understand), but with another naming (I can rename files and variables if You prefer).
Yep, I look at the commit graph and it is a mistery to me :)
Perfect ! Of course concerns can mean a lot of things. The names you used suggested to me that you made a module just for this class.
I guess what I mean by concerns is more scope than functionality:
wwwapiclihlsAnd the
main()puts everything together.That way if we implement some super fancy progress bar or elaborate AsciiArt output it can all go in
cli. So far it was not really needed but I guess more stuff should now migrate from__main__tocli.As for now, we always need the (url, version, resolution) arguments and we process them in that very order (and only the last one might ever have a default value one day, see below). So I don't necessarly see the point at puting them behind flags (
-l,-r)When #8 comes along, I can see who a
--name-pattern(whatever the short version can be) could come to use. Because there should by (in my opinion) a default value for this, something like "{title}{separator}{subtitle}" with another--name-separatordefaulting to" - "(or other)Also, as you mentioned in #8 if there is ever a config file with default preferences for naming pattern, prefered resolution, having a
--config-fileto target the non default location (~/.delarte.tomlfor instance) makes sens to me.For now I would keep the parser for later configurations, but keep the trio without flags.
What do you people think ?
I think it is more "userproof" with flags: an user that provides a link, and a resolution but no language code would be badly interpreted by argparse: positionnal arguments HAVE TO be given in the very order of the prototype, because argparse creates a Namespace object, which is a key:value structure.
pathologic case:
If you define the prototype as
if a user gives
argparse library creates
it's up to You deciding whether you want to guide the users but annoy them more, or guide less but annoy them less.
btw, making this modification is easy, I already did it on my local branch, tell me if You want me pushing it...
Alright, I discussed the named vs. positional in #1
For the rest it looks fine to me, last time I checked I picked up that
epilog, maybe you could put it as the module docstring and refer to it as__doc__so it serves both asclimodule documentation AND usage string from the parser (like it was done in__main__.py-r(something about output directory)🩹 naming: not "languages", "version"WIP-CLI-argument-#1to WIP: CLI-argument-#1I tried to move all the changes introduced in this branch except the redundant one that creates conflicts in this branch in PR #18. it remains only a few files in conflict, and I don't know how to do this in gitea. in my local repo "git merge from stable branch" works automatically.
should I push my stable branch?
Okay why not :)
WIP: CLI-argument-#1to CLI-argument-#1CLI-argument-#1to WPI: CLI-argument-#1Pull request closed