From 4b6782efcf4ec6d29fd56bf5be77a3619622f589 Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Sat, 23 Dec 2023 20:14:14 -0700 Subject: [PATCH] Update: confirmation for git clone script --- bin/clone_with_ssh.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/clone_with_ssh.py b/bin/clone_with_ssh.py index bb30c2c..ae5df71 100755 --- a/bin/clone_with_ssh.py +++ b/bin/clone_with_ssh.py @@ -2,6 +2,7 @@ import argparse import re import sys +import os from subprocess import Popen SSH_RE = re.compile(r"(ssh://)?git@([^/]+):([^/]+)/([^/]+)(/[^/]+)?.*") @@ -43,4 +44,12 @@ git_cmd = ["git", "clone", ssh_url] if args.out_name is not None: git_cmd.append(args.out_name) +initial_dirs = set(filter(lambda x: os.path.isdir(x), os.listdir())) + Popen(git_cmd).wait() + +current_dirs = set(filter(lambda x: os.path.isdir(x), os.listdir())) +new_dirs = current_dirs - initial_dirs + +if len(new_dirs) == 1: + print(f"====\nCloned in `{list(new_dirs)[0]}`")