git-rexec 1.0.1__tar.gz → 1.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-rexec
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: Locate Git repositories and execute commands against them in parallel.
5
5
  Author: James Cherti
6
- License: GPL-3.0-or-later
6
+ License-Expression: GPL-3.0-or-later
7
7
  Project-URL: Homepage, https://github.com/jamescherti/git-rexec
8
8
  Keywords: git,parallel,executor,automation
9
9
  Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
11
10
  Classifier: Operating System :: OS Independent
12
11
  Classifier: Environment :: Console
13
12
  Classifier: Topic :: Software Development :: Version Control :: Git
@@ -48,6 +47,11 @@ Here are examples demonstrating how to use `git-rexec`:
48
47
  git-rexec --if-exec 'sh -c "test -f README.md"' --parallel -- wc -l README.md
49
48
  ```
50
49
 
50
+ - Print the paths of all discovered Git repositories:
51
+ ```bash
52
+ git-rexec --print
53
+ ```
54
+
51
55
  If this helps your workflow, please support the project by **⭐ starring git-rexec on GitHub** and sharing it on your website, blog, Mastodon, Reddit, X, LinkedIn, or other social media platforms to help more Git users discover its benefits.
52
56
 
53
57
  ## Features
@@ -57,6 +61,7 @@ If this helps your workflow, please support the project by **⭐ starring git-re
57
61
  - Execute shell commands across multiple repositories in parallel using worker threads.
58
62
  - Filter target repositories based on the exit code of a conditional check (`--if-exec`).
59
63
  - Exclude specific directories from the search path.
64
+ - Export discovered repository paths for integration with other shell tools (using `--print` or `--print0`).
60
65
 
61
66
  ## Installation
62
67
 
@@ -96,7 +101,7 @@ pip install colorama setproctitle
96
101
  ## Usage
97
102
 
98
103
  ```bash
99
- git-rexec [OPTIONS] [exec_cmd ...]
104
+ git-rexec [OPTIONS] -- [exec_cmd ...]
100
105
  ```
101
106
 
102
107
  *(Assuming the `git-rexec` script is executable and in your PATH.)*
@@ -107,14 +112,31 @@ git-rexec [OPTIONS] [exec_cmd ...]
107
112
 
108
113
  ### Options
109
114
 
110
- - `-C, --directory <path>`: The root directory to start searching for Git repositories. Defaults to the current working directory (`.`).
111
- - `--exclude-dir <path>`: Exclude a specific directory and all of its subdirectories from the search. This option can be provided multiple times.
112
- - `-p, --parallel`: Execute the command in parallel using threads.
113
- - `-i, --if-exec <command>`: Execute the main command only if this check command returns an exit code of `0`.
114
- - `-j, --jobs <int>`: The maximum number of concurrent workers/processors to use for parallel execution. Defaults to the number of CPU cores available.
115
- - `-s, --include-sub-repos`: Include sub-repositories (e.g., Git worktrees and submodules) in the search target list.
116
- - `-h, --help`: Show the help message and exit.
117
- - `-q, --quiet`: Quiet mode. Suppresses the informational tracking headers (`[EXEC]` and `[EXEC-P]`) that prefix execution output. In sequential mode, it hides the `[EXEC]` repository delimiter line entirely; in parallel mode (`-p`), it strips the yellow `[EXEC-P]` header track and removes the four-space indentation, printing only the raw, unindented stdout and stderr streams. This flag has no effect when no execution command is supplied, allowing discovered repository paths to print normally.
115
+ ```
116
+ usage: git-rexec [-h] [-C DIRECTORY] [--exclude-dir EXCLUDE_DIR] [-p] [-i IF_EXEC] [-j MAX_WORKERS] [-q] [-s] [--print] [--print0] [exec_cmd ...]
117
+
118
+ Find Git repositories and execute commands against them in parallel.
119
+
120
+ positional arguments:
121
+ exec_cmd The command to execute. You can use -- to pass options.
122
+
123
+ options:
124
+ -h, --help show this help message and exit
125
+ -C, --directory DIRECTORY
126
+ Root directory to search (defaults to current directory)
127
+ --exclude-dir EXCLUDE_DIR
128
+ Exclude a specific directory and all of its subdirectories
129
+ -p, --parallel Execute the command in parallel using threads
130
+ -i, --if-exec IF_EXEC
131
+ Execute commands only if this check returns exit code 0.
132
+ -j, --jobs MAX_WORKERS
133
+ Maximum number of processors/workers to use
134
+ -q, --quiet Quiet mode. Suppresses the informational log prefixes ([EXEC] and [EXEC-P]) that precede execution output.
135
+ -s, --include-sub-repos
136
+ Include sub-repositories (e.g., Git worktrees and submodules)
137
+ --print Print the paths (only when no command is provided)
138
+ --print0 Separate the paths with a null character (only when no command is provided)
139
+ ```
118
140
 
119
141
  ## License
120
142
 
@@ -29,6 +29,11 @@ Here are examples demonstrating how to use `git-rexec`:
29
29
  git-rexec --if-exec 'sh -c "test -f README.md"' --parallel -- wc -l README.md
30
30
  ```
31
31
 
32
+ - Print the paths of all discovered Git repositories:
33
+ ```bash
34
+ git-rexec --print
35
+ ```
36
+
32
37
  If this helps your workflow, please support the project by **⭐ starring git-rexec on GitHub** and sharing it on your website, blog, Mastodon, Reddit, X, LinkedIn, or other social media platforms to help more Git users discover its benefits.
33
38
 
34
39
  ## Features
@@ -38,6 +43,7 @@ If this helps your workflow, please support the project by **⭐ starring git-re
38
43
  - Execute shell commands across multiple repositories in parallel using worker threads.
39
44
  - Filter target repositories based on the exit code of a conditional check (`--if-exec`).
40
45
  - Exclude specific directories from the search path.
46
+ - Export discovered repository paths for integration with other shell tools (using `--print` or `--print0`).
41
47
 
42
48
  ## Installation
43
49
 
@@ -77,7 +83,7 @@ pip install colorama setproctitle
77
83
  ## Usage
78
84
 
79
85
  ```bash
80
- git-rexec [OPTIONS] [exec_cmd ...]
86
+ git-rexec [OPTIONS] -- [exec_cmd ...]
81
87
  ```
82
88
 
83
89
  *(Assuming the `git-rexec` script is executable and in your PATH.)*
@@ -88,14 +94,31 @@ git-rexec [OPTIONS] [exec_cmd ...]
88
94
 
89
95
  ### Options
90
96
 
91
- - `-C, --directory <path>`: The root directory to start searching for Git repositories. Defaults to the current working directory (`.`).
92
- - `--exclude-dir <path>`: Exclude a specific directory and all of its subdirectories from the search. This option can be provided multiple times.
93
- - `-p, --parallel`: Execute the command in parallel using threads.
94
- - `-i, --if-exec <command>`: Execute the main command only if this check command returns an exit code of `0`.
95
- - `-j, --jobs <int>`: The maximum number of concurrent workers/processors to use for parallel execution. Defaults to the number of CPU cores available.
96
- - `-s, --include-sub-repos`: Include sub-repositories (e.g., Git worktrees and submodules) in the search target list.
97
- - `-h, --help`: Show the help message and exit.
98
- - `-q, --quiet`: Quiet mode. Suppresses the informational tracking headers (`[EXEC]` and `[EXEC-P]`) that prefix execution output. In sequential mode, it hides the `[EXEC]` repository delimiter line entirely; in parallel mode (`-p`), it strips the yellow `[EXEC-P]` header track and removes the four-space indentation, printing only the raw, unindented stdout and stderr streams. This flag has no effect when no execution command is supplied, allowing discovered repository paths to print normally.
97
+ ```
98
+ usage: git-rexec [-h] [-C DIRECTORY] [--exclude-dir EXCLUDE_DIR] [-p] [-i IF_EXEC] [-j MAX_WORKERS] [-q] [-s] [--print] [--print0] [exec_cmd ...]
99
+
100
+ Find Git repositories and execute commands against them in parallel.
101
+
102
+ positional arguments:
103
+ exec_cmd The command to execute. You can use -- to pass options.
104
+
105
+ options:
106
+ -h, --help show this help message and exit
107
+ -C, --directory DIRECTORY
108
+ Root directory to search (defaults to current directory)
109
+ --exclude-dir EXCLUDE_DIR
110
+ Exclude a specific directory and all of its subdirectories
111
+ -p, --parallel Execute the command in parallel using threads
112
+ -i, --if-exec IF_EXEC
113
+ Execute commands only if this check returns exit code 0.
114
+ -j, --jobs MAX_WORKERS
115
+ Maximum number of processors/workers to use
116
+ -q, --quiet Quiet mode. Suppresses the informational log prefixes ([EXEC] and [EXEC-P]) that precede execution output.
117
+ -s, --include-sub-repos
118
+ Include sub-repositories (e.g., Git worktrees and submodules)
119
+ --print Print the paths (only when no command is provided)
120
+ --print0 Separate the paths with a null character (only when no command is provided)
121
+ ```
99
122
 
100
123
  ## License
101
124
 
@@ -6,7 +6,7 @@
6
6
  #
7
7
  # Author: James Cherti
8
8
  # URL: https://github.com/jamescherti/git-rexec
9
- # Version: 1.0.1
9
+ # Version: 1.0.3
10
10
  #
11
11
  # Copyright (C) 2019-2026 James Cherti
12
12
  #
@@ -125,6 +125,7 @@ def git_py_find_repo(root: Path) -> tuple[set[Path], set[Path]]:
125
125
 
126
126
  return repos, sub_repos
127
127
 
128
+
128
129
  def get_sub_repos(repo_path: Path) -> set[Path]:
129
130
  """Extract worktrees and submodules from a Git repository.
130
131
 
@@ -191,7 +192,6 @@ def get_sub_repos(repo_path: Path) -> set[Path]:
191
192
  return sub_repos
192
193
 
193
194
 
194
-
195
195
  def run_command_get_output(repo_path: Path, cmd_list: list[str],
196
196
  capture: bool = True) -> CommandResult:
197
197
  """Execute a shell command within a specific directory.
@@ -376,7 +376,8 @@ def parse_args() -> argparse.Namespace:
376
376
  :return: Parsed arguments.
377
377
  """
378
378
  parser: argparse.ArgumentParser = argparse.ArgumentParser(
379
- description="Find git repos and execute commands.",
379
+ description=("Find Git repositories and execute commands against "
380
+ "them in parallel."),
380
381
  formatter_class=argparse.RawDescriptionHelpFormatter
381
382
  )
382
383
  parser.add_argument(
@@ -413,8 +414,8 @@ def parse_args() -> argparse.Namespace:
413
414
  parser.add_argument(
414
415
  "-q", "--quiet",
415
416
  action="store_true",
416
- help=("Quiet mode. Suppresses the informational tracking headers "
417
- "([EXEC] and [EXEC-P]) that prefix execution output."),
417
+ help=("Quiet mode. Suppresses the informational log prefixes "
418
+ "([EXEC] and [EXEC-P]) that precede execution output."),
418
419
  default=False
419
420
  )
420
421
  parser.add_argument(
@@ -423,6 +424,19 @@ def parse_args() -> argparse.Namespace:
423
424
  help="Include sub-repositories (e.g., Git worktrees and submodules)",
424
425
  default=False
425
426
  )
427
+ parser.add_argument(
428
+ "--print",
429
+ action="store_true",
430
+ help="Print the paths (only when no command is provided)",
431
+ default=False
432
+ )
433
+ parser.add_argument(
434
+ "--print0",
435
+ action="store_true",
436
+ help=("Separate the paths with a null character (only when no "
437
+ "command is provided)"),
438
+ default=False
439
+ )
426
440
  parser.add_argument(
427
441
  "exec_cmd",
428
442
  type=str,
@@ -484,6 +498,11 @@ def main() -> None:
484
498
 
485
499
  args: argparse.Namespace = parse_args()
486
500
 
501
+ # Check for empty action
502
+ if not args.exec_cmd and not args.print and not args.print0:
503
+ print("Nothing to do.", file=sys.stderr)
504
+ sys.exit(2)
505
+
487
506
  # Verify that the execution command exists
488
507
  if args.exec_cmd and not shutil.which(args.exec_cmd[0]):
489
508
  print(
@@ -566,7 +585,10 @@ def main() -> None:
566
585
 
567
586
  # If no commands were run, just list the repo
568
587
  if not args.exec_cmd:
569
- print(repo_path)
588
+ if args.print0:
589
+ print(repo_path, end="\0")
590
+ elif args.print:
591
+ print(repo_path)
570
592
 
571
593
  # Final Error Summary
572
594
  sys.exit(print_error_summary(execution_errors))
@@ -575,6 +597,9 @@ def main() -> None:
575
597
  if __name__ == "__main__":
576
598
  try:
577
599
  main()
578
- except (KeyboardInterrupt, BrokenPipeError):
600
+ except KeyboardInterrupt:
601
+ print("\nInterrupting...", file=sys.stderr)
602
+ sys.exit(130)
603
+ except BrokenPipeError:
579
604
  print("\nInterrupting...", file=sys.stderr)
580
- sys.exit(1)
605
+ sys.exit(141)
@@ -1,13 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-rexec
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: Locate Git repositories and execute commands against them in parallel.
5
5
  Author: James Cherti
6
- License: GPL-3.0-or-later
6
+ License-Expression: GPL-3.0-or-later
7
7
  Project-URL: Homepage, https://github.com/jamescherti/git-rexec
8
8
  Keywords: git,parallel,executor,automation
9
9
  Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
11
10
  Classifier: Operating System :: OS Independent
12
11
  Classifier: Environment :: Console
13
12
  Classifier: Topic :: Software Development :: Version Control :: Git
@@ -48,6 +47,11 @@ Here are examples demonstrating how to use `git-rexec`:
48
47
  git-rexec --if-exec 'sh -c "test -f README.md"' --parallel -- wc -l README.md
49
48
  ```
50
49
 
50
+ - Print the paths of all discovered Git repositories:
51
+ ```bash
52
+ git-rexec --print
53
+ ```
54
+
51
55
  If this helps your workflow, please support the project by **⭐ starring git-rexec on GitHub** and sharing it on your website, blog, Mastodon, Reddit, X, LinkedIn, or other social media platforms to help more Git users discover its benefits.
52
56
 
53
57
  ## Features
@@ -57,6 +61,7 @@ If this helps your workflow, please support the project by **⭐ starring git-re
57
61
  - Execute shell commands across multiple repositories in parallel using worker threads.
58
62
  - Filter target repositories based on the exit code of a conditional check (`--if-exec`).
59
63
  - Exclude specific directories from the search path.
64
+ - Export discovered repository paths for integration with other shell tools (using `--print` or `--print0`).
60
65
 
61
66
  ## Installation
62
67
 
@@ -96,7 +101,7 @@ pip install colorama setproctitle
96
101
  ## Usage
97
102
 
98
103
  ```bash
99
- git-rexec [OPTIONS] [exec_cmd ...]
104
+ git-rexec [OPTIONS] -- [exec_cmd ...]
100
105
  ```
101
106
 
102
107
  *(Assuming the `git-rexec` script is executable and in your PATH.)*
@@ -107,14 +112,31 @@ git-rexec [OPTIONS] [exec_cmd ...]
107
112
 
108
113
  ### Options
109
114
 
110
- - `-C, --directory <path>`: The root directory to start searching for Git repositories. Defaults to the current working directory (`.`).
111
- - `--exclude-dir <path>`: Exclude a specific directory and all of its subdirectories from the search. This option can be provided multiple times.
112
- - `-p, --parallel`: Execute the command in parallel using threads.
113
- - `-i, --if-exec <command>`: Execute the main command only if this check command returns an exit code of `0`.
114
- - `-j, --jobs <int>`: The maximum number of concurrent workers/processors to use for parallel execution. Defaults to the number of CPU cores available.
115
- - `-s, --include-sub-repos`: Include sub-repositories (e.g., Git worktrees and submodules) in the search target list.
116
- - `-h, --help`: Show the help message and exit.
117
- - `-q, --quiet`: Quiet mode. Suppresses the informational tracking headers (`[EXEC]` and `[EXEC-P]`) that prefix execution output. In sequential mode, it hides the `[EXEC]` repository delimiter line entirely; in parallel mode (`-p`), it strips the yellow `[EXEC-P]` header track and removes the four-space indentation, printing only the raw, unindented stdout and stderr streams. This flag has no effect when no execution command is supplied, allowing discovered repository paths to print normally.
115
+ ```
116
+ usage: git-rexec [-h] [-C DIRECTORY] [--exclude-dir EXCLUDE_DIR] [-p] [-i IF_EXEC] [-j MAX_WORKERS] [-q] [-s] [--print] [--print0] [exec_cmd ...]
117
+
118
+ Find Git repositories and execute commands against them in parallel.
119
+
120
+ positional arguments:
121
+ exec_cmd The command to execute. You can use -- to pass options.
122
+
123
+ options:
124
+ -h, --help show this help message and exit
125
+ -C, --directory DIRECTORY
126
+ Root directory to search (defaults to current directory)
127
+ --exclude-dir EXCLUDE_DIR
128
+ Exclude a specific directory and all of its subdirectories
129
+ -p, --parallel Execute the command in parallel using threads
130
+ -i, --if-exec IF_EXEC
131
+ Execute commands only if this check returns exit code 0.
132
+ -j, --jobs MAX_WORKERS
133
+ Maximum number of processors/workers to use
134
+ -q, --quiet Quiet mode. Suppresses the informational log prefixes ([EXEC] and [EXEC-P]) that precede execution output.
135
+ -s, --include-sub-repos
136
+ Include sub-repositories (e.g., Git worktrees and submodules)
137
+ --print Print the paths (only when no command is provided)
138
+ --print0 Separate the paths with a null character (only when no command is provided)
139
+ ```
118
140
 
119
141
  ## License
120
142
 
@@ -4,18 +4,17 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "git-rexec"
7
- version = "1.0.1"
7
+ version = "1.0.3"
8
8
  description = "Locate Git repositories and execute commands against them in parallel."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
11
- license = {text = "GPL-3.0-or-later"}
11
+ license = "GPL-3.0-or-later"
12
12
  authors = [
13
13
  {name = "James Cherti"}
14
14
  ]
15
15
  keywords = ["git", "parallel", "executor", "automation"]
16
16
  classifiers = [
17
17
  "Programming Language :: Python :: 3",
18
- "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
19
18
  "Operating System :: OS Independent",
20
19
  "Environment :: Console",
21
20
  "Topic :: Software Development :: Version Control :: Git"
File without changes
File without changes