package export

import (
	
	
	

	
)

type Export struct {
	Version string `json:"version"`
	common.Meta
	Values common.RawValues `json:"values"`
}

func ( Export) () ([]byte, error) {
	sort.Sort(common.ByValue(.Values))
	return json.Marshal(&struct {
		 string `json:"version"`
		common.Meta
		 common.RawValues `json:"values"`
	}{
		: version(),
		:    .Meta,
		:  .Values,
	})
}

func version() string {
	if ,  := debug.ReadBuildInfo();  {
		for ,  := range .Deps {
			if .Path == "github.com/carapace-sh/carapace" {
				return .Version
			}
		}
	}
	return "unknown"
}