AllPac/cmd/cli_utils.go
VetheonGames 0e91ff7ba2 Minor Update 3
This I think brings us up to a proper release. Since now we have installers and the Readme is finished.

changes to cli_utils.go:
```
- Add handling for a command to print out the current version of AllPac
```

changes to main.go:
```
- Add command to print out the current version of AllPac
```

Created and embedded .version file to facilitate above feature
2024-01-07 18:30:16 -07:00

28 lines
607 B
Go

package main
import (
"fmt"
"embed"
"io/fs"
"pixelridgesoftworks.com/AllPac/pkg/logger"
)
func handleUpdateError(updateOption string, err error) {
if err != nil {
fmt.Printf("Error occurred during '%s' update: %v\n", updateOption, err)
} else {
fmt.Printf("Update '%s' completed successfully.\n", updateOption)
}
}
//go:embed .version
var versionFS embed.FS
func handleVersion(args []string) {
content, err := fs.ReadFile(versionFS, ".version")
if err != nil {
logger.Errorf("Error reading version file: %v", err)
}
fmt.Println(string(content))
}