49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package command
|
||
|
||
import (
|
||
"fmt"
|
||
commandEmailPassToOidc "scripts/internal/command/email_pass_to_oidc"
|
||
)
|
||
|
||
func InitSripts() {
|
||
scripts := map[string]*Commands{
|
||
commandEmailPassToOidc.Name: {
|
||
Exec: commandEmailPassToOidc.UsersUpdateLoginMethod,
|
||
Requirements: commandEmailPassToOidc.Requirement,
|
||
Description: "переводит авторизацию пользователей с ролью 'system_user' c почта/пароль на keycloak",
|
||
},
|
||
"help": {
|
||
Exec: Help,
|
||
Requirements: Requirement,
|
||
Description: "вывод всех доступных скриптов",
|
||
},
|
||
}
|
||
|
||
Scripts = scripts
|
||
}
|
||
|
||
var Scripts map[string]*Commands
|
||
|
||
type Commands struct {
|
||
Exec Execute
|
||
Requirements Requirements
|
||
Description string
|
||
}
|
||
|
||
type Execute func() error
|
||
type Requirements func() string
|
||
|
||
func Help() error {
|
||
fmt.Printf("All commands:\n\n")
|
||
for k, v := range Scripts {
|
||
fmt.Printf("name: %s\n", k)
|
||
fmt.Printf("description: %s\n", v.Description)
|
||
fmt.Printf("requirements: %s\n\n", v.Requirements())
|
||
}
|
||
return nil
|
||
}
|
||
|
||
func Requirement() string {
|
||
return "none"
|
||
}
|