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
2025-09-28 22:04:48 +02:00
parent 2c677d8db4
commit a816b827cf
74 changed files with 407 additions and 333 deletions

View File

@@ -308,9 +308,9 @@ func generateFiles() {
}
}
var versionPattern = `var version = ".*"`
var versionPattern = `const Version = ".*"`
const versionCodeFile = "cmd/restic/global.go"
const versionCodeFile = "internal/global/global.go"
func updateVersion() {
err := os.WriteFile("VERSION", []byte(opts.Version+"\n"), 0644)
@@ -318,7 +318,7 @@ func updateVersion() {
die("unable to write version to file: %v", err)
}
newVersion := fmt.Sprintf("var version = %q", opts.Version)
newVersion := fmt.Sprintf("const Version = %q", opts.Version)
replace(versionCodeFile, versionPattern, newVersion)
if len(uncommittedChanges("VERSION")) > 0 || len(uncommittedChanges(versionCodeFile)) > 0 {