new --version option and qualities method in obiscript

Former-commit-id: 7b0ce2901785d5c7494dec3a7a95d1fc5dc4a52b
This commit is contained in:
Eric Coissac
2024-04-13 12:40:43 +02:00
parent 0a2ea962db
commit cb35612a6c
5 changed files with 97 additions and 5 deletions

View File

@ -21,6 +21,7 @@ var _BatchSize = 5000
var _Pprof = false
var _Quality_Shift_Input = 33
var _Quality_Shift_Output = 33
var _Version = "4.2.1"
type ArgumentParser func([]string) (*getoptions.GetOpt, []string)
@ -30,6 +31,7 @@ func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser
options.SetMode(getoptions.Bundling)
options.SetUnknownMode(getoptions.Fail)
options.Bool("help", false, options.Alias("h", "?"))
options.Bool("version", false)
options.BoolVar(&_Debug, "debug", false)
options.BoolVar(&_Pprof, "pprof", false)
@ -62,6 +64,11 @@ func GenerateOptionParser(optionset ...func(*getoptions.GetOpt)) ArgumentParser
os.Exit(1)
}
if options.Called("version") {
fmt.Fprintf(os.Stderr, "obitools version %s\n", _Version)
os.Exit(0)
}
log.SetLevel(log.InfoLevel)
if options.Called("debug") {
log.SetLevel(log.DebugLevel)