extract GlobalOptions into internal/global package

Rough steps:
```
mv cmd/restic/global* cmd/restic/secondary_repo* internal/global/
sed -i "s/package main/package global/" internal/global/*.go
Rename "GlobalOptions" to "Options" in internal/global/
Replace everywhere " GlobalOptions" -> " global.Options"
Replace everywhere "\*GlobalOptions" -> " *global.Options"
Make SecondaryRepoOptions public
Make create public
Make version public
```
This commit is contained in:
Michael Eischer committed 2025-10-12 17:56:28 +02:00
1 parent 2c677d8db4
commit a816b827cf
74 files changed
+407 -333

No files matched your search

+4 -3
View File
@@ -4,11 +4,12 @@ import (
"encoding/json"
"runtime"
"github.com/restic/restic/internal/global"
"github.com/restic/restic/internal/ui"
"github.com/spf13/cobra"
)
func newVersionCommand(globalOptions *GlobalOptions) *cobra.Command {
func newVersionCommand(globalOptions *global.Options) *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Print version information",
@@ -37,7 +38,7 @@ Exit status is 1 if there was any error.
jsonS := jsonVersion{
MessageType: "version",
Version: version,
Version: global.Version,
GoVersion: runtime.Version(),
GoOS: runtime.GOOS,
GoArch: runtime.GOARCH,
@@ -50,7 +51,7 @@ Exit status is 1 if there was any error.
}
} else {
printer.S("restic %s compiled with %v on %v/%v\n",
version, runtime.Version(), runtime.GOOS, runtime.GOARCH)
global.Version, runtime.Version(), runtime.GOOS, runtime.GOARCH)
}
},
}