diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -11,6 +11,7 @@ import ( "os/signal" "time" + "github.com/alecthomas/chroma/v2/styles" "golang.org/x/crypto/bcrypt" "git.gabrielgio.me/cerrado/pkg/config" @@ -71,9 +72,7 @@ func key() error { } func run(ctx context.Context) error { - var ( - configPath = flag.String("config", "/etc/cerrado.scfg", "File path for the configuration file") - ) + configPath := flag.String("config", "/etc/cerrado.scfg", "File path for the configuration file") flag.Parse() @@ -83,6 +82,17 @@ func run(ctx context.Context) error { return err } + // checking chroma configurationo + + if _, ok := styles.Registry[configRepo.GetSyntaxHighlight()]; !ok { + slog.Warn( + "Invalid Syntax highlight selected", + "invalid-style", configRepo.GetSyntaxHighlight(), + "using", "monokailight", + ) + styles.Fallback = styles.Registry["monokailight"] + } + // services gitService := service.NewGitService(configRepo) |