all repos — searchix @ 70b87ff06ed982adca32658aee4a1e78c39c3f41

Search engine for NixOS, nix-darwin, home-manager and NUR users

cmd/searchix-web/defaults.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
25
26
27
28
29
30
31
32
33
34
package main

import (
	"fmt"

	"github.com/Southclaws/fault"

	"alin.ovh/searchix/internal/config"
)

type PrintDefaultsOptions struct{}

func (*PrintDefaultsOptions) Execute(_ []string) error {
	_, err := fmt.Print(config.GetDefaultConfig())
	if err != nil {
		return fault.Wrap(err)
	}

	return nil
}

func init() {
	var opts PrintDefaultsOptions

	_, err := parser.AddCommand(
		"defaults",
		"print defaults",
		"print default configuration",
		&opts,
	)
	if err != nil {
		panic(err)
	}
}