Files
lpm/cmd/add_repository.go
zeekay 7d7127a687 deps: update to latest luxfi packages
- Update node v1.16.15 → v1.19.8
- Update crypto v1.17.0 → v1.17.4
- Update database v1.2.0 → v1.2.1
- Update geth v1.16.34 → v1.16.35
- Update ids v1.1.0 → v1.1.1
- Update Go 1.25 → 1.25.1
- Update copyright year to 2025
2025-09-30 00:05:18 +00:00

50 lines
1.1 KiB
Go

// Copyright (C) 2019-2025, Lux Partners Limited. All rights reserved.
// See the file LICENSE for licensing terms.
package cmd
import (
"github.com/spf13/afero"
"github.com/spf13/cobra"
)
func addRepository(fs afero.Fs) *cobra.Command {
url := ""
alias := ""
branch := ""
command := &cobra.Command{
Use: "add-repository",
Short: "Adds a custom repository to the list of tracked repositories",
}
command.PersistentFlags().StringVar(&alias, "alias", "", "alias for the repository")
err := command.MarkPersistentFlagRequired("alias")
if err != nil {
// TODO cleanup these panics
panic(err)
}
command.PersistentFlags().StringVar(&url, "url", "", "url to the repository")
err = command.MarkPersistentFlagRequired("url")
if err != nil {
panic(err)
}
command.PersistentFlags().StringVar(&branch, "branch", "", "branch name to track")
err = command.MarkPersistentFlagRequired("branch")
if err != nil {
panic(err)
}
command.RunE = func(_ *cobra.Command, _ []string) error {
lpm, err := initLPM(fs)
if err != nil {
return err
}
return lpm.AddRepository(alias, url, branch)
}
return command
}