cli

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright 2022 Red Hat, Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Copyright 2022 Red Hat, Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Package cli contains miscellaneous definitions that are related with Syncron's command line client.

The purpose of this package is to bridge the gap between Cobra (the CLI framework) and Syncron so that they both get to use the same values and, thus, understanding between the two components gets easier.

Copyright 2022 Red Hat, Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Copyright 2022 Red Hat, Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Copyright 2022 Red Hat, Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Index

Constants

View Source
const (
	Insights   string = "insights"
	SOSReports string = "sosreports"
	All        string = "all"
	Parquet    string = "parquet"
)

Keywords used as arguments on the CLI.

View Source
const (
	Debug string = "debug"

	Days           string = "days"
	Months         string = "months"
	Years          string = "years"
	Filter         string = "filter"
	Output         string = "output"
	File           string = "file"
	AccountN       string = "account-number"
	QueryID        string = "query-id"
	GenerateCharts string = "generate-charts"
)

Keywords used as flags on the CLI.

View Source
const (
	D string = "d"
)

Keywords used as shortcuts on the CLI.

Variables

View Source
var Components []string
View Source
var DeploymentID string
View Source
var GenCharts bool
View Source
var OneDepByID bool

Functions

func ChartSelector added in v1.0.0

func ChartSelector(selection []string) bool

func ComponentSelector added in v1.0.0

func ComponentSelector() []string

func DeploymentIDSelector added in v1.0.0

func DeploymentIDSelector() string

func IniBar added in v1.0.0

func IniBar(suffix string) *spinner.Spinner

func IniSpinner added in v1.0.0

func IniSpinner(suffix string) *spinner.Spinner

func MainSelector added in v1.0.0

func MainSelector()

Types

type CLIParser

type CLIParser interface {
	// GetDebug indicates whether the debug mode for Syncron has been
	// requested (true) or not (false).
	GetDebug() bool
}

CLIParser makes sense out of the data retrieved from a CLI framework.

An implementation will ease access to the options the user has defined through the command line, such as the logging mode or the location of a configuration file.

type CobraParser

type CobraParser struct {
	// contains filtered or unexported fields
}

CobraParser takes care of extracting all interesting data from the structures provided by the Cobra CLI framework by implementing the cli.CLIParser interface.

func NewParserForCobra

func NewParserForCobra(cmd *cobra.Command, args []string) *CobraParser

NewParserForCobra returns a new cli.CobraParser that will get to work with the Cobra structures given to it.

func (*CobraParser) GetDebug

func (parser *CobraParser) GetDebug() bool

GetDebug implements cli.CLIParser.GetDebug by extracting the value of the 'debug' flag from Cobra's input data.

Jump to

Keyboard shortcuts

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