blob: 94433abfbee15659d828ef44206df666d0cfffae (
plain) (
blame)
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
|
package commands
import (
"fmt"
"os"
"github.com/Fuwn/yae/internal/yae"
"github.com/urfave/cli/v2"
)
func Init(sources *yae.Environment) func(c *cli.Context) error {
return func(c *cli.Context) error {
if _, err := os.Stat(c.String("sources")); err == nil {
return fmt.Errorf("sources file already exists")
}
sources.Sources = make(map[string]yae.Source)
sources.Schema = "https://raw.githubusercontent.com/Fuwn/yae/refs/heads/main/yae.schema.json"
if c.Bool("dry-run") {
return nil
}
return sources.Save(c.String("sources"))
}
}
|