2024-03-15 11:42:22 +01:00
|
|
|
// Copyright 2021-2022 - offen.software <hioffen@posteo.de>
|
2021-08-22 18:07:32 +02:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2021-08-21 19:05:49 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-02-06 21:05:38 +01:00
|
|
|
"flag"
|
2021-08-21 19:05:49 +02:00
|
|
|
)
|
|
|
|
|
2024-02-06 21:05:38 +01:00
|
|
|
func main() {
|
2024-02-09 10:24:28 +01:00
|
|
|
foreground := flag.Bool("foreground", false, "run the tool in the foreground")
|
2024-02-10 12:10:16 +01:00
|
|
|
profile := flag.String("profile", "", "collect runtime metrics and log them periodically on the given cron expression")
|
2024-02-06 21:05:38 +01:00
|
|
|
flag.Parse()
|
|
|
|
|
2024-02-09 10:24:28 +01:00
|
|
|
c := newCommand()
|
|
|
|
if *foreground {
|
2024-02-13 19:21:57 +01:00
|
|
|
opts := foregroundOpts{
|
|
|
|
profileCronExpression: *profile,
|
|
|
|
}
|
|
|
|
c.must(c.runInForeground(opts))
|
2024-02-06 21:05:38 +01:00
|
|
|
} else {
|
2024-02-09 10:24:28 +01:00
|
|
|
c.must(c.runAsCommand())
|
2024-02-06 21:05:38 +01:00
|
|
|
}
|
2021-12-17 20:45:15 +01:00
|
|
|
}
|