mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-25 06:15:56 +01:00
38 lines
862 B
Go
38 lines
862 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/semaphoreui/semaphore/cli/setup"
|
|
"github.com/semaphoreui/semaphore/util"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
runnerCmd.AddCommand(runnerSetupCmd)
|
|
}
|
|
|
|
var runnerSetupCmd = &cobra.Command{
|
|
Use: "setup",
|
|
Short: "Perform interactive setup",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
doRunnerSetup()
|
|
},
|
|
}
|
|
|
|
// nolint: gocyclo
|
|
func doRunnerSetup() int {
|
|
config := &util.ConfigType{}
|
|
|
|
setup.InteractiveRunnerSetup(config)
|
|
|
|
resultConfigPath := setup.SaveConfig(config, "config-runner.json", persistentFlags.configPath)
|
|
|
|
util.ConfigInit(resultConfigPath, false)
|
|
|
|
fmt.Printf(" Re-launch this program pointing to the configuration file\n\n./semaphore runner --config %v\n\n", resultConfigPath)
|
|
fmt.Printf(" To run as daemon:\n\nnohup ./semaphore runner --config %v &\n\n", resultConfigPath)
|
|
|
|
return 0
|
|
}
|