aboutsummaryrefslogtreecommitdiff
path: root/internal/commands/init.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/commands/init.go')
-rw-r--r--internal/commands/init.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/commands/init.go b/internal/commands/init.go
new file mode 100644
index 0000000..f38ec96
--- /dev/null
+++ b/internal/commands/init.go
@@ -0,0 +1,19 @@
+package commands
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/Fuwn/yae/internal/yae"
+ "github.com/urfave/cli/v2"
+)
+
+func Init(sources *yae.Sources) 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")
+ }
+
+ return sources.Save(c.String("sources"))
+ }
+}