refactor: remove the need of the logger in the create oidc client cmd

This commit is contained in:
Stavros
2026-02-26 17:11:24 +02:00
parent 3531adfbb5
commit e4f4c25ece

View File

@@ -1,12 +1,12 @@
package main
import (
"errors"
"fmt"
"regexp"
"github.com/google/uuid"
"github.com/steveiliop56/tinyauth/internal/utils"
"github.com/steveiliop56/tinyauth/internal/utils/tlog"
"github.com/traefik/paerser/cli"
)
@@ -18,10 +18,8 @@ func createOidcClientCmd() *cli.Command {
Resources: nil,
AllowArg: true,
Run: func(args []string) error {
tlog.NewSimpleLogger().Init()
if len(args) == 0 {
tlog.App.Fatal().Msg("Client name is required. Use tinyauth oidc create <name>")
return errors.New("client name is required. use tinyauth oidc create <name>")
}
clientName := args[0]
@@ -29,7 +27,7 @@ func createOidcClientCmd() *cli.Command {
match, err := regexp.MatchString("^[a-zA-Z0-9-]*$", clientName)
if !match || err != nil {
tlog.App.Fatal().Msg("Client name can only contain alphanumeric characters and hyphens")
return errors.New("client name can only contain alphanumeric characters and hyphens")
}
uuid := uuid.New()