-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Feature Request - Chaining multiple commands in series #59
Comments
Not a bad idea IMO, but I am not sure how we can build that - somehow we'd need to know whether a "word" is an argument to a previous command, or if it is already the next command to execute 🤔 To illustrate: git_sim add foo.py commit stash pop It might be kinda easy to figure out that I guess this might be doable by comparing each word to all command names and comparing it to "where in the command/subcommand tree are we right now?", but to me it looks not trivial to implement. |
The simple case where each command takes no arguments is actually surprisingly simple, but of course it does not help with the previously mentioned problem... import typer
app = typer.Typer()
@app.command(name="bar")
def bar():
print("bar")
@app.command(name="baz")
def baz():
print("baz")
@app.command(name="multi")
def multi(cmds: list[str]):
registered_func_names = [reg_cmd.name for reg_cmd in app.registered_commands]
for cmd in cmds:
if cmd in registered_func_names:
func = globals()[cmd]
func()
else:
print(f"'{cmd}' is not a valid command, skipping...")
if __name__ == "__main__":
app() $ python foo.py multi one two bar foo baz baz boo bar
'one' is not a valid command, skipping...
'two' is not a valid command, skipping...
bar
'foo' is not a valid command, skipping...
baz
baz
'boo' is not a valid command, skipping...
bar |
I can imagine at least 3 different ways to handle that :
|
@jygastaud Interesting thought! We might consider this in the future but for now, we have to focus on getting full coverage of the most common Git commands before we think about chaining together into a larger workflow. Closing for now. |
Just started using git-sim few days ago and thought exactly the same. |
Hi,
Thanks for the time you invest in that project. It will help a lot to explain concept.
What could be really cool would be to be able to chain many command and display an image with all those steps and not each step in individual image.
"Basic exemple" would be to have
checkout
a new branch,add
,commit
+ merge in previous branch in the same image.The text was updated successfully, but these errors were encountered: