build: add tool for managing repos
diff --git a/cmd/atmosphere-ci/image.go b/cmd/atmosphere-ci/image.go
new file mode 100644
index 0000000..492d2b9
--- /dev/null
+++ b/cmd/atmosphere-ci/image.go
@@ -0,0 +1,14 @@
+package main
+
+import (
+ "github.com/spf13/cobra"
+)
+
+var imageCmd = &cobra.Command{
+ Use: "image",
+ Short: "Image sub-commands",
+}
+
+func init() {
+ rootCmd.AddCommand(imageCmd)
+}
diff --git a/cmd/atmosphere-ci/image_repo.go b/cmd/atmosphere-ci/image_repo.go
new file mode 100644
index 0000000..2ab4d4a
--- /dev/null
+++ b/cmd/atmosphere-ci/image_repo.go
@@ -0,0 +1,14 @@
+package main
+
+import (
+ "github.com/spf13/cobra"
+)
+
+var imageRepoCmd = &cobra.Command{
+ Use: "repo",
+ Short: "Image repository sub-commands",
+}
+
+func init() {
+ imageCmd.AddCommand(imageRepoCmd)
+}
diff --git a/cmd/atmosphere-ci/image_repo_sync.go b/cmd/atmosphere-ci/image_repo_sync.go
new file mode 100644
index 0000000..e4f9667
--- /dev/null
+++ b/cmd/atmosphere-ci/image_repo_sync.go
@@ -0,0 +1,31 @@
+package main
+
+import (
+ "context"
+
+ log "github.com/sirupsen/logrus"
+ "github.com/spf13/cobra"
+ "github.com/vexxhost/atmosphere/internal/pkg/image_repositories"
+)
+
+var (
+ imageRepoSyncCmd = &cobra.Command{
+ Use: "sync [project]",
+ Short: "Sync image repository",
+ Args: cobra.MinimumNArgs(1),
+
+ Run: func(cmd *cobra.Command, args []string) {
+ ctx := context.TODO()
+
+ repo := image_repositories.NewImageRepository(args[0])
+ err := repo.Synchronize(ctx)
+ if err != nil {
+ log.Panic(err)
+ }
+ },
+ }
+)
+
+func init() {
+ imageRepoCmd.AddCommand(imageRepoSyncCmd)
+}
diff --git a/cmd/atmosphere-ci/main.go b/cmd/atmosphere-ci/main.go
new file mode 100644
index 0000000..48e4f2e
--- /dev/null
+++ b/cmd/atmosphere-ci/main.go
@@ -0,0 +1,20 @@
+package main
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/spf13/cobra"
+)
+
+var rootCmd = &cobra.Command{
+ Use: "atmosphere-ci",
+ Short: "CLI tools for Atmosphere CI",
+}
+
+func main() {
+ if err := rootCmd.Execute(); err != nil {
+ fmt.Fprintln(os.Stderr, err)
+ os.Exit(1)
+ }
+}