blob: c4bc138675845fdf654bfc3c1f4cd00321b6ba69 (
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
|
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")
}
if c.Bool("dry-run") {
return nil
}
return sources.Save(c.String("sources"))
}
}
|