Restore TrackProjectCommand + comment (so we can use it later for telemetry)

Signed-off-by: Joel Longtine <joel@dagger.io>
This commit is contained in:
Joel Longtine 2022-02-18 16:39:22 -07:00
parent b32e2da0a5
commit 55bf5ff4dd

View File

@ -28,6 +28,34 @@ func commandName(cmd *cobra.Command) string {
return strings.Join(parts, " ")
}
// TrackProjectCommand is like TrackCommand but includes project and
// optionally environment metadata.
// func TrackProjectCommand(ctx context.Context, cmd *cobra.Command, w *state.Project, env *state.State, props ...*telemetry.Property) chan struct{} {
// props = append([]*telemetry.Property{
// {
// // Hash the repository URL for privacy
// Name: "git_repository_hash",
// Value: hash(gitRepoURL(w.Path)),
// },
// {
// // The project path might contain the username (e.g. /home/user/project), so we hash it for privacy.
// Name: "project_path_hash",
// Value: hash(w.Path),
// },
// }, props...)
// if env != nil {
// props = append([]*telemetry.Property{
// {
// Name: "environment_name",
// Value: env.Name,
// },
// }, props...)
// }
// return TrackCommand(ctx, cmd, props...)
// }
// hash returns the sha256 digest of the string
// func hash(s string) string {
// return fmt.Sprintf("%x", sha256.Sum256([]byte(s)))