cmd

package
v1.14.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2025 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SummaryPath = "licensing/licences.csv"
	DetailsPath = "licensing/all_licences.csv"
)
View Source
const SourcesOptionsText = "Override configured licence source.\n(Repeat as required)"

Variables

View Source
var GDNACmd = &cobra.Command{
	Use:   "gdna [FLAGS...]",
	Short: "Process Geneos License Usage Data",
	Long:  rootCmdDescription,
	Args:  cobra.ArbitraryArgs,
	CompletionOptions: cobra.CompletionOptions{
		DisableDefaultCmd: true,
	},
	Version:               cordial.VERSION,
	DisableAutoGenTag:     true,
	DisableSuggestions:    true,
	DisableFlagsInUseLine: true,
	PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) {
		if daemon {
			return process.Daemon(nil, process.RemoveArgs, "-D", "--daemon")
		}

		initConfig(cmd)

		if !cf.IsSet("gdna.version") {
			cf.Set("gdna.version", cordial.VERSION)
		}

		return
	},
}

GDNACmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

type Allocation

type Allocation struct {
	Name       string     `mapstructure:"name"`
	Token      string     `mapstructure:"token"`
	Allocation int        `mapstructure:"allocation"`
	Comment    string     `mapstructure:"comment,omitempty"`
	User       string     `mapstructure:"user,omitempty"`
	Origin     string     `mapstructure:"origin"`
	Timestamp  *time.Time `mapstructure:"timestamp,omitempty"`
}

type Filter

type Filter struct {
	Name      string     `mapstructure:"name"`
	Pattern   []string   `mapstructure:"pattern"`
	Comment   string     `mapstructure:"comment,omitempty"`
	User      string     `mapstructure:"user,omitempty"`
	Origin    string     `mapstructure:"origin"`
	Timestamp *time.Time `mapstructure:"timestamp,omitempty"`
}

type Group

type Group struct {
	Name      string     `mapstructure:"name"`
	Patterns  []string   `mapstructure:"patterns"`
	Comment   string     `mapstructure:"comment,omitempty"`
	User      string     `mapstructure:"user,omitempty"`
	Origin    string     `mapstructure:"origin"`
	Timestamp *time.Time `mapstructure:"timestamp,omitempty"`
}

type Report

type Report struct {
	// remember to "squash" the embedded struct to UnmarshalKey() works right
	reporter.Report `mapstructure:",squash"`

	// gdna / SQL query specific
	Subreport string `mapstructure:"-"`
	Type      string `mapstructure:"type,omitempty"`
	Query     string `mapstructure:"query,omitempty"`
	Headlines string `mapstructure:"headlines,omitempty"`

	// when Type = "split" then
	SplitColumn    string `mapstructure:"split-column,omitempty"`
	SplitValues    string `mapstructure:"split-values-query,omitempty"`
	SplitValuesAll string `mapstructure:"split-values-query-all,omitempty"`

	Grouping      string   `mapstructure:"grouping,omitempty"`
	GroupingOrder []string `mapstructure:"grouping-order,omitempty"`
}

Reporter is the GDNA specific reporter struct

type Sources

type Sources []string

Sources is a slice of licence data sources

func (*Sources) Set

func (i *Sources) Set(value string) error

func (*Sources) String

func (i *Sources) String() string

func (*Sources) Type

func (i *Sources) Type() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL