From 4b64fdd0cd1709b8b4ce3a0aff50f2e1e8f30fbb Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 25 Oct 2024 09:56:14 +0000 Subject: feat(yae): add optional schema field --- internal/commands/add.go | 2 +- internal/commands/drop.go | 2 +- internal/commands/init.go | 2 +- internal/commands/update.go | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'internal/commands') diff --git a/internal/commands/add.go b/internal/commands/add.go index 1b32533..07bee28 100644 --- a/internal/commands/add.go +++ b/internal/commands/add.go @@ -50,7 +50,7 @@ func AddFlags() []cli.Flag { } } -func Add(sources *yae.Sources) func(c *cli.Context) error { +func Add(sources *yae.Environment) func(c *cli.Context) error { return func(c *cli.Context) error { if c.Args().Len() != 2 { return fmt.Errorf("invalid number of arguments") diff --git a/internal/commands/drop.go b/internal/commands/drop.go index f30afb6..788b62b 100644 --- a/internal/commands/drop.go +++ b/internal/commands/drop.go @@ -7,7 +7,7 @@ import ( "github.com/urfave/cli/v2" ) -func Drop(sources *yae.Sources) func(c *cli.Context) error { +func Drop(sources *yae.Environment) func(c *cli.Context) error { return func(c *cli.Context) error { if c.Args().Len() == 0 { return fmt.Errorf("invalid number of arguments") diff --git a/internal/commands/init.go b/internal/commands/init.go index 4d41553..c4bc138 100644 --- a/internal/commands/init.go +++ b/internal/commands/init.go @@ -8,7 +8,7 @@ import ( "github.com/urfave/cli/v2" ) -func Init(sources *yae.Sources) func(c *cli.Context) error { +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") diff --git a/internal/commands/update.go b/internal/commands/update.go index fa7e09f..5889d3a 100644 --- a/internal/commands/update.go +++ b/internal/commands/update.go @@ -28,14 +28,14 @@ func UpdateFlags() []cli.Flag { } } -func Update(sources *yae.Sources) func(c *cli.Context) error { +func Update(sources *yae.Environment) func(c *cli.Context) error { return func(c *cli.Context) error { updates := []string{} force := c.Bool("force-hashed") forcePinned := c.Bool("force-pinned") if c.Args().Len() == 0 { - for name, source := range *sources { + for name, source := range sources.Sources { if updated, err := source.Update(sources, name, force, forcePinned); err != nil { return err } else if updated { @@ -44,7 +44,7 @@ func Update(sources *yae.Sources) func(c *cli.Context) error { } } else { name := c.Args().Get(0) - source := (*sources)[name] + source := (*sources).Sources[name] if updated, err := source.Update(sources, name, force, forcePinned); err != nil { return err -- cgit v1.2.3