Added support for stash subcommands - push/pop/apply#60
Conversation
Signed-off-by: Abhijit Nathwani <abhijit.nathwani@gmail.com>
|
@abhijitnathwani cool stuff! I see you used an Enum to solve the subcommand problem (which is fine!), I think at some point we should refactor subcommands into their own Typer apps and then add them to the main Typer app as described in the Typer docs HERE (instead of adding them as commands to the main app). The main advantage being that we can then nest as deep as we want, and it also removes the need for the extra Enum class. So instead of # stash.py
def stash():
...
# __main__.py
import typer
import git_sim.stash
app = typer.Typer()
app.command()(git_sim.stash.stash)we'd have something like # stash.py
import typer
app = typer.Typer()
@app.command()
def stash():
...
# __main__.py
import typer
import git_sim.stash
app = typer.Typer()
app.add_typer(git_sim.stash.app, name="stash")Unfortunately I will not be available the next weeks, but in case you want to start with that, I trust you'll navigate the Typer docs just fine without me nagging all the time 😆 |
|
Hi @paketb0te |
|
@abhijitnathwani Thanks for this! I agree with the discussion above - I'll merge this for now and test it. And think we should do @paketb0te 's Typer suggestion for the subcommands going forward. @abhijitnathwani can you create a new issue for that? FYI this is also my first time using Typer :D |
Fixes #1