add goreleaser configuration for binaries and deb/rpm packages

- build static binaries for linux, darwin and freebsd
- create deb and rpm packages that register gosh in /etc/shells
- publish releases to Gitea
- add --version flag, set at build time via ldflags

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Florian WaltherandClaude Opus 5.5 committed 2026-10-03 16:58:50 +02:00
1 parent d5c3d03a21
commit 37d6802815
6 files changed
+152

No files matched your search

+8
View File
@@ -19,6 +19,9 @@ import (
// ErrNoPath is returned when 'cd' was called without a second argument.
var ErrNoPath = errors.New("path required")
// version is set at build time via -ldflags "-X main.version=..."
var version = "dev"
// previousDir tracks the previous working directory for 'cd -' support
var previousDir string
@@ -483,6 +486,11 @@ func completeFilePath(line, prefix string) []string {
}
func main() {
if len(os.Args) > 1 && (os.Args[1] == "--version" || os.Args[1] == "-V") {
fmt.Println("gosh", version)
return
}
// Ctrl+C sends SIGINT to the whole foreground process group. Catch it so
// that it only stops the running command and not the shell. (signal.Ignore
// would be inherited by the child processes.)