Skip to content

Commit

Permalink
Add WIP checkout command
Browse files Browse the repository at this point in the history
  • Loading branch information
Esteban Beltran committed Apr 19, 2022
1 parent ea4e6cb commit 2b9aaa0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/commands/checkout.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import click
from src.tmux import is_inside_tmux
from src.util import is_tool
import os
import sys


@click.command()
@click.argument("tag", required=True)
def checkout(tag):
"""
Quickly creates a new context with the passed PR tag checked out,
then bootstrap and starts kibbe setmeup
"""
if not is_tool("gh"):
click.echo("You must install github cli for this feature to work")
exit(1)

if not is_inside_tmux():
click.echo("You must run this command inside a tmux session")
exit(1)

branch = tag.replace(":", "-")

kibbe_command = sys.argv[0]
os.system("git branch -D %s" % branch)
os.system("%s ctx -i %s" % (kibbe_command, branch))
os.system("gh pr checkout %s" % tag)
os.system("%s setmeup --tmux" % kibbe_command)
2 changes: 2 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from src.commands.setlicense import setlicense
from src.commands.setmeup import setmeup
from src.commands.jest import jest
from src.commands.checkout import checkout
from src.util import force_kibana_root


Expand Down Expand Up @@ -42,6 +43,7 @@ def cli():
cli.add_command(ctx)
cli.add_command(config)
cli.add_command(jest)
cli.add_command(checkout)


def exit_():
Expand Down

0 comments on commit 2b9aaa0

Please sign in to comment.