diff options
| author | Fuwn <[email protected]> | 2024-10-11 04:19:59 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-10-11 04:19:59 +0000 |
| commit | 8daa0742b7268a94dac4076311cfe4e0323cbe60 (patch) | |
| tree | 3af2a3c86b5728e37c625f52ce62425e38cf59b4 /yae.go | |
| parent | refactor!: wiene -> yae (diff) | |
| download | yae-8daa0742b7268a94dac4076311cfe4e0323cbe60.tar.xz yae-8daa0742b7268a94dac4076311cfe4e0323cbe60.zip | |
feat(yae): add init sub-command
Diffstat (limited to 'yae.go')
| -rw-r--r-- | yae.go | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -25,6 +25,10 @@ func main() { }, }, Before: func(c *cli.Context) error { + if args := c.Args(); args.Len() == 1 && args.Get(0) == "init" { + return nil + } + return sources.Load(c.String("sources")) }, Flags: []cli.Flag{ @@ -43,6 +47,17 @@ func main() { Suggest: true, Commands: []*cli.Command{ { + Name: "init", + Usage: "Initialise a new Yae environment", + Action: 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")) + }, + }, + { Name: "add", Args: true, ArgsUsage: "<name> <uri>", |