all repos

smutok @ 725a325a3e91135aedd57142f7ecbbd6e9a5a239

yet another tui rss reader (not abandoned, just paused development)

smutok/cmd_init.go(view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package main

import (
	"context"
	"fmt"
	"log/slog"

	"github.com/urfave/cli/v3"
	"olexsmir.xyz/smutok/internal/config"
)

var initConfigCmd = &cli.Command{
	Name:   "init",
	Usage:  "Initialize smutok's config",
	Action: initConfig,
}

func initConfig(ctx context.Context, c *cli.Command) error {
	if err := config.Init(); err != nil {
		return fmt.Errorf("failed to init config: %w", err)
	}
	slog.Info("Config was initialized, enter your credentials", "file", config.MustGetConfigFilePath())
	return nil
}