Documentation ¶
Overview ¶
Package datum is our cobra/viper cli implementation
Index ¶
- Variables
- func Execute()
- func GetFields(i interface{}) (res []string)
- func GetHeaders(s interface{}, prefix string) []string
- func JSONPrint(s []byte) error
- func RowsTablePrint(resp GraphResponse) error
- func SingleRowTablePrint(r interface{}) error
- func TablePrint(header []string, data [][]string) error
- func ViperBindFlag(name string, flag *pflag.Flag)
- type CLI
- type Edge
- type GraphResponse
- type RequiredFieldMissingError
Constants ¶
This section is empty.
Variables ¶
var ( // RootHost contains the root url for the Datum API RootHost string // GraphAPIHost contains the url for the Datum graph api GraphAPIHost string )
var (
Logger *zap.SugaredLogger
)
var RootCmd = &cobra.Command{ Use: appName, Short: fmt.Sprintf("a %s cli", appName), }
RootCmd 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.
func GetFields ¶
func GetFields(i interface{}) (res []string)
GetFields returns the value of each field in a struct
func GetHeaders ¶
GetHeaders returns the name of each field in a struct
func RowsTablePrint ¶
func RowsTablePrint(resp GraphResponse) error
RowsTablePrint prints a table to the console with multiple rows using a map[string]interface{} as the row data
func SingleRowTablePrint ¶
func SingleRowTablePrint(r interface{}) error
SingleRowTablePrint prints a single row table to the console
func TablePrint ¶
TablePrint prints a table to the console
func ViperBindFlag ¶
ViperBindFlag provides a wrapper around the viper bindings that panics if an error occurs
Types ¶
type CLI ¶
type CLI struct { Client geodeticclient.GeodeticClient Interceptor clientv2.RequestInterceptor AccessToken string }
func GetGraphClient ¶
type Edge ¶
type Edge struct {
Node interface{} `json:"node"`
}
Edge is a single edge in the graph response
type GraphResponse ¶
type GraphResponse struct {
Edges []Edge `json:"edges"`
}
GraphResponse is the response from the graph api containing a list of edges
type RequiredFieldMissingError ¶
type RequiredFieldMissingError struct { // Field contains the required field that was missing from the input Field string }
RequiredFieldMissingError is returned when a field is required but not provided
func NewRequiredFieldMissingError ¶
func NewRequiredFieldMissingError(f string) *RequiredFieldMissingError
NewRequiredFieldMissingError returns an error for a missing required field
func (*RequiredFieldMissingError) Error ¶
func (e *RequiredFieldMissingError) Error() string
Error returns the RequiredFieldMissingError in string format
Directories ¶
Path | Synopsis |
---|---|
Package geodeticdatabase is our cobra/viper cli for database endpoints
|
Package geodeticdatabase is our cobra/viper cli for database endpoints |
Package geodeticgroup is our cobra/viper cli for group endpoints
|
Package geodeticgroup is our cobra/viper cli for group endpoints |
Package version contains the version information for the CLI
|
Package version contains the version information for the CLI |