Skip to content

Commit 4ce00aa

Browse files
mslinnclaude
andcommitted
Add version number to all command help outputs
- Created internal/version.go with Version constant set to "0.1.13" - Updated all command help functions to display version in format "command v0.1.13" - Modified commands: git-commitAll, git-evars, git-exec, git-list-executables, git-replicate, git-treeconfig, git-update - Updated CHANGELOG.md for version 0.1.13 All commands now show their version in help output, making it easier to verify which version is installed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b597da7 commit 4ce00aa

9 files changed

Lines changed: 21 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Fixed path condensation in `git-exec` command. Output now properly abbreviates paths using environment variable names
66
(e.g., `$sites/project` instead of `/mnt/d/sites/project`).
7+
- Added version number to help output for all commands (displays as "v0.1.13" in command help text).
78

89
## 0.1.12 / 2025-10-10
910

cmd/git-commitAll/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func main() {
4242

4343
func showHelp() {
4444
config := internal.NewConfig()
45-
fmt.Printf(heredoc.Doc(`git-commitAll - Recursively commits and pushes changes in all git repositories under the specified roots.
45+
fmt.Printf(heredoc.Doc(`git-commitAll v%s - Recursively commits and pushes changes in all git repositories under the specified roots.
4646
If no directories are given, uses default roots (%s) as roots.
4747
Skips directories containing a .ignore file, and all subdirectories.
4848
Repositories in a detached HEAD state are skipped.
@@ -71,7 +71,7 @@ func showHelp() {
7171
7272
Note: When environment variables are used as roots, output paths will be condensed.
7373
For example: "Committed and pushed changes in $work/project"
74-
`), strings.Join(config.DefaultRoots, ", "))
74+
`), internal.Version, strings.Join(config.DefaultRoots, ", "))
7575
}
7676

7777
func processRepo(walker *internal.GitTreeWalker, dir string, threadID int, config *internal.Config) {

cmd/git-evars/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func main() {
6262
func showHelp() {
6363
config := internal.NewConfig()
6464
fmt.Printf(heredoc.Doc(`
65-
git-evars - Generate bash environment variables for each git repository found under specified directory trees.
65+
git-evars v%s - Generate bash environment variables for each git repository found under specified directory trees.
6666
6767
Examines trees of git repositories and writes a bash script to STDOUT.
6868
If no directories are given, uses default roots (%s) as roots.
@@ -92,7 +92,7 @@ func showHelp() {
9292
Usage examples:
9393
$ git-evars # Use default environment variables as roots
9494
$ git-evars '$work $sites' # Use specific environment variables
95-
`), strings.Join(config.DefaultRoots, ", "))
95+
`), internal.Version, strings.Join(config.DefaultRoots, ", "))
9696
}
9797

9898
func envVarName(path string) string {

cmd/git-exec/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func main() {
5757
func showHelp() {
5858
config := internal.NewConfig()
5959
fmt.Printf(heredoc.Doc(`
60-
git-exec - Executes an arbitrary shell command for each repository.
60+
git-exec v%s - Executes an arbitrary shell command for each repository.
6161
6262
If no arguments are given, uses default roots (%s) as roots.
6363
These environment variables point to roots of git repository trees to walk.
@@ -90,7 +90,7 @@ func showHelp() {
9090
9191
3) For all subdirectories of the current directory, update Gemfile.lock and install a local copy of the gem:
9292
$ git-exec . 'bundle update && rake install'
93-
`), strings.Join(config.DefaultRoots, ", "))
93+
`), internal.Version, strings.Join(config.DefaultRoots, ", "))
9494
}
9595

9696
func executeAndLog(dir, command string, walker *internal.GitTreeWalker) {

cmd/git-list-executables/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"fmt"
55
"os"
66
"path/filepath"
7+
8+
"github.com/mslinn/git_tree_go/internal"
79
)
810

911
// Lists executables installed by git-tree-go
@@ -32,7 +34,7 @@ func main() {
3234
os.Exit(1)
3335
}
3436

35-
fmt.Printf("Executables installed by git-tree-go in: %s\n\n", dir)
37+
fmt.Printf("Executables installed by git-tree-go v%s in: %s\n\n", internal.Version, dir)
3638
for _, entry := range entries {
3739
name := entry.Name()
3840
description := descriptions[name]

cmd/git-replicate/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func main() {
4747
func showHelp() {
4848
config := internal.NewConfig()
4949
fmt.Printf(heredoc.Doc(`
50-
git-replicate - Replicates trees of git repositories and writes a bash script to STDOUT.
50+
git-replicate v%s - Replicates trees of git repositories and writes a bash script to STDOUT.
5151
5252
If no directories are given, uses default roots (%s) as roots.
5353
The script clones the repositories and replicates any remotes.
@@ -69,7 +69,7 @@ func showHelp() {
6969
Usage examples:
7070
$ git-replicate '$work'
7171
$ git-replicate '$work $sites'
72-
`), strings.Join(config.DefaultRoots, ", "))
72+
`), internal.Version, strings.Join(config.DefaultRoots, ", "))
7373
}
7474

7575
func replicateOne(dir, rootArg string, walker *internal.GitTreeWalker) []string {

cmd/git-treeconfig/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ import (
1313
)
1414

1515
func showHelp() {
16-
fmt.Println(heredoc.Doc(`
17-
git-treeconfig - Configure git-tree settings
16+
fmt.Printf(heredoc.Doc(`
17+
git-treeconfig v%s - Configure git-tree settings
1818
This utility creates a configuration file at $HOME/.treeconfig.yml
1919
Press Enter to accept the default value in brackets.
2020
2121
Usage: git-treeconfig [OPTIONS]
2222
2323
OPTIONS:
2424
-h Show this help message
25-
`))
25+
`), internal.Version)
2626
os.Exit(0)
2727
}
2828

cmd/git-update/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func main() {
3434
func showHelp() {
3535
config := internal.NewConfig()
3636
fmt.Printf(heredoc.Doc(`
37-
git-update - Recursively updates trees of git repositories.
37+
git-update v%s - Recursively updates trees of git repositories.
3838
3939
If no arguments are given, uses default roots (%s) as roots.
4040
These environment variables point to roots of git repository trees to walk.
@@ -67,7 +67,7 @@ func showHelp() {
6767
Note: When environment variables are used as roots (e.g., $work), output paths
6868
will be condensed using the variable name. For example:
6969
Updating $work/CanPolitique (instead of /mnt/f/work/CanPolitique)
70-
`), strings.Join(config.DefaultRoots, ", "))
70+
`), internal.Version, strings.Join(config.DefaultRoots, ", "))
7171
}
7272

7373
func processRepo(walker *internal.GitTreeWalker, dir string, threadID int, config *internal.Config) {

internal/version.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package internal
2+
3+
// Version is the current version of git-tree-go
4+
const Version = "0.1.13"

0 commit comments

Comments
 (0)