cmdutils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFieldResolution

func ApplyFieldResolution(data []formatter.GenericTableData, enableResolve bool) error

ApplyFieldResolution applies field resolution to table data in-place This should be called once during data preparation, not in individual formatters

func ContainsHelp

func ContainsHelp(args []string) bool

ContainsHelp checks if "help" is present in the arguments

func FormatNestedValue

func FormatNestedValue(value interface{}) string

FormatNestedValue formats a nested value for display. Handles special cases like arrays, maps, and nil values.

func GetCacheAccessor

func GetCacheAccessor() (*vendors.CacheAccessor, error)

GetCacheAccessor returns the cache accessor for commands (delegates to vendors package singleton)

func GetNestedValue

func GetNestedValue(data map[string]interface{}, path string) (interface{}, bool)

GetNestedValue retrieves a value from a nested map using dot-separated path. Supports paths like "radio_config.band_5.channel" or "ip_config.vlan_id".

func IsMAC

func IsMAC(s string) bool

IsMAC checks if a string is a valid MAC address using the macaddr package

func NewCacheTableAccessor

func NewCacheTableAccessor() (formatter.CacheAccessor, error)

NewCacheTableAccessor creates a table-compatible cache accessor

func NormalizeDeviceType

func NormalizeDeviceType(deviceType string) string

NormalizeDeviceType converts device type aliases to canonical form

func ValidateDeviceType

func ValidateDeviceType(deviceType string) error

ValidateDeviceType validates that the device type is supported

func ValidateInventoryArgs

func ValidateInventoryArgs(_ *cobra.Command, args []string) error

ValidateInventoryArgs validates arguments for the show inventory command

func ValidateShowAPArgs

func ValidateShowAPArgs(_ *cobra.Command, args []string) error

ValidateShowAPArgs validates arguments for the show api ap command

Types

type CacheTableAccessor

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

CacheTableAccessor implements formatter.CacheAccessor for table formatting It provides access to full device config data and supports nested field lookups.

func (*CacheTableAccessor) GetCachedData

func (c *CacheTableAccessor) GetCachedData(index string) (map[string]interface{}, bool)

GetCachedData retrieves full cached config data by MAC address. This returns the complete device configuration including all vendor-specific fields.

func (*CacheTableAccessor) GetFieldByPath

func (c *CacheTableAccessor) GetFieldByPath(data map[string]interface{}, path string) (interface{}, bool)

GetFieldByPath retrieves a nested field value by dot-separated path. This supports paths like "radio_config.band_5.channel" or "ip_config.vlan_id".

func (*CacheTableAccessor) GetSiteName

func (c *CacheTableAccessor) GetSiteName(siteID string) (string, bool)

GetSiteName provides site name lookup capability

func (*CacheTableAccessor) ResolveID

func (c *CacheTableAccessor) ResolveID(fieldName string, id string) (string, bool)

ResolveID resolves an ID to a human-readable name based on the field type. Supports: deviceprofile_id, site_id, map_id, rf_template_id, etc.

type ParsedApplyArgs

type ParsedApplyArgs struct {
	SiteName   string
	Operation  string
	DeviceType string
	ExtraArgs  []string
}

ParsedApplyArgs represents parsed arguments for apply commands

func ParseApplyArgs

func ParseApplyArgs(args []string) (*ParsedApplyArgs, error)

ParseApplyArgs parses positional arguments for apply commands Supports pattern: <site-name> <operation> [extra-args...]

type ParsedShowArgs

type ParsedShowArgs struct {
	Filter     string
	SiteName   string
	Target     string // API target label (e.g., "mist-prod", "meraki")
	Format     string
	ShowAll    bool
	NoResolve  bool
	DeviceType string
}

ParsedShowArgs represents parsed arguments for show commands

func ParseShowArgs

func ParseShowArgs(args []string) (*ParsedShowArgs, error)

ParseShowArgs parses positional arguments for show commands Supports patterns like: [name-or-mac] [site site-name] [target api-label] [json|csv] [all] [no-resolve]

Jump to

Keyboard shortcuts

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