diff options
Diffstat (limited to 'gita/utils.py')
-rw-r--r-- | gita/utils.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gita/utils.py b/gita/utils.py index 8e7d9c4..5332255 100644 --- a/gita/utils.py +++ b/gita/utils.py @@ -279,6 +279,7 @@ def _make_name(path: str, repos: Dict[str, Dict[str, str]], def add_repos(repos: Dict[str, Dict[str, str]], new_paths: List[str], include_bare=False, exclude_submodule=False, + dry_run=False, ) -> Dict[str, Dict[str, str]]: """ Write new repo paths to file; return the added repos. @@ -291,6 +292,10 @@ def add_repos(repos: Dict[str, Dict[str, str]], new_paths: List[str], new_repos = {} if new_paths: print(f"Found {len(new_paths)} new repo(s).") + if dry_run: + for p in new_paths: + print(p) + return {} name_counts = Counter( os.path.basename(os.path.normpath(p)) for p in new_paths ) @@ -453,14 +458,14 @@ def get_cmds_from_files() -> Dict[str, Dict[str, str]]: return cmds -def parse_repos_and_rest(input: List[str] +def parse_repos_and_rest(input: List[str], quote_mode=False, ) -> Tuple[Dict[str, Dict[str, str]], List[str]]: """ Parse gita input arguments @return: repos and the rest (e.g., gita shell and super commands) """ - i = None + i = 0 names = [] repos = get_repos() groups = get_groups() @@ -475,6 +480,10 @@ def parse_repos_and_rest(input: List[str] i += 1 if not names and ctx: names = [ctx.stem] + if quote_mode and i + 1 != len(input): + print(input[i], 'is not a repo or group' ) + sys.exit(2) + if names: chosen = {} for k in names: |