gittuf/internal/cmd/trustpolicy/remote/pull/pull.go
Aditya Sirish A Yelgundhalli eda8a89e2a
repository -> gittuf: Expose a gittuf Go API
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
2024-10-23 13:30:35 -04:00

34 lines
651 B
Go

// Copyright The gittuf Authors
// SPDX-License-Identifier: Apache-2.0
package pull
import (
"github.com/gittuf/gittuf/experimental/gittuf"
"github.com/spf13/cobra"
)
type options struct {
}
func (o *options) Run(_ *cobra.Command, args []string) error {
repo, err := gittuf.LoadRepository()
if err != nil {
return err
}
return repo.PullPolicy(args[0])
}
func New() *cobra.Command {
o := &options{}
cmd := &cobra.Command{
Use: "pull <remote>",
Short: "Pull policy from the specified remote",
Args: cobra.ExactArgs(1),
RunE: o.Run,
DisableAutoGenTag: true,
}
return cmd
}