gittuf/internal/cmd/cache/init/init.go
PratGit1606 9707977fd3 docs: audit and fix CLI command docstrings across all commands
Signed-off-by: PratGit1606 <prathamgithub16@gmail.com>
2026-07-08 12:02:33 -07:00

36 lines
878 B
Go

// Copyright The gittuf Authors
// SPDX-License-Identifier: Apache-2.0
package init
import (
"github.com/gittuf/gittuf/experimental/gittuf"
"github.com/spf13/cobra"
)
type options struct{}
func (o *options) AddFlags(_ *cobra.Command) {}
func (o *options) Run(_ *cobra.Command, _ []string) error {
repo, err := gittuf.LoadRepository(".")
if err != nil {
return err
}
return repo.PopulateCache()
}
func New() *cobra.Command {
o := &options{}
cmd := &cobra.Command{
Use: "init",
Short: "Initialize persistent cache",
Long: `The 'init' command initializes the local persistent cache for a gittuf repository, intended to improve performance of gittuf operations. This cache is local-only and is not synchronized with the remote.`,
RunE: o.Run,
DisableAutoGenTag: true,
}
o.AddFlags(cmd)
return cmd
}