Skip to content

Commit

Permalink
Merge pull request #83 from timgates42/feature/improve
Browse files Browse the repository at this point in the history
Improve background behaviour
  • Loading branch information
timgates42 committed Mar 24, 2020
2 parents 9429585 + 78630f6 commit b7e7c1c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
11 changes: 6 additions & 5 deletions app/meticulous/_addrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def handler():
reponame = interactive_pickrepo()
if reponame is None:
context.controller.add(
{"name": "prompt_quit", "interactive": True, "priority": 50}
{"name": "prompt_quit", "interactive": True, "priority": 65}
)
context.controller.add(
{"name": "repository_checkout", "interactive": False, "reponame": reponame}
Expand All @@ -67,7 +67,7 @@ def handler():
{
"name": "repository_summary",
"interactive": True,
"priority": 50,
"priority": 55,
"reponame": reponame,
}
)
Expand All @@ -83,9 +83,8 @@ def repository_summary(context):
def handler():
target = context.controller.target
reponame = context.taskjson["reponame"]
if get_confirmation(f"Display readme for {reponame}?"):
repodir = target / reponame
display_repo_intro(repodir)
repodir = target / reponame
display_repo_intro(repodir)
context.controller.add(
{
"name": "collect_nonwords",
Expand All @@ -94,6 +93,8 @@ def handler():
"reponame": reponame,
}
)
if get_confirmation(f"Do you want to quit?"):
context.controller.quit()

return handler

Expand Down
20 changes: 7 additions & 13 deletions app/meticulous/_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
Handlers for checking existing forks and creating new ones.
"""

import sys

import github
from plumbum import FG, local
from plumbum import local

from meticulous._secrets import load_api_key
from meticulous._storage import get_value, set_value
Expand Down Expand Up @@ -94,18 +92,14 @@ def checkout(repo, target):
user_org = api.get_user().login
clone_target = target / repo
if clone_target.exists():
print(f"{clone_target} already exists, clone aborted.", file=sys.stderr)
sys.exit(1)
return
git = local["/usr/bin/git"]
with local.cwd(str(target)):
_ = (
git[
"clone",
"--depth=3",
f"ssh://git@github.com/{user_org}/{repo}",
str(clone_target),
]
& FG
git(
"clone",
"--depth=3",
f"ssh://git@github.com/{user_org}/{repo}",
str(clone_target),
)


Expand Down
6 changes: 3 additions & 3 deletions app/meticulous/_multiworker.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def handler():
{
"name": "submit",
"interactive": True,
"priority": 60,
"priority": 50,
"reponame": reponame,
}
)
Expand All @@ -95,7 +95,7 @@ def handler():
{
"name": "cleanup",
"interactive": True,
"priority": 70,
"priority": 20,
"reponame": reponame,
}
)
Expand All @@ -116,7 +116,7 @@ def handler():
reposave = repository_map[reponame]
remove_repo_for(reponame, reposave, confirm=False)
context.controller.add(
{"name": "prompt_quit", "interactive": True, "priority": 40}
{"name": "prompt_quit", "interactive": True, "priority": 10}
)

return handler
Expand Down

0 comments on commit b7e7c1c

Please sign in to comment.