Results

package
v0.2.41 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package CnsPanel provides a structure and functions for handling console command flags.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlagParseResult

type FlagParseResult struct {
	// Parsed arguments.
	Args com.ArgumentsMap

	// Index of the last unsuccessful parse argument.
	Index int
}

FlagParseResult represents the result of parsing a flag.

func NewFlagParseResult

func NewFlagParseResult(args com.ArgumentsMap, index int) *FlagParseResult

NewFlagParseResult creates a new FlagParseResult with the given arguments, index, and ignorable boolean.

Parameters:

  • args: The arguments to parse.
  • index: The index of the last unsuccessful parse argument.

Returns:

  • *FlagParseResult: A pointer to the new FlagParseResult.

type ParsedCommand

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

ParsedCommand represents a parsed console command.

func NewParsedCommand

func NewParsedCommand(args com.ArgumentsMap, callbackFunc com.CommandCallbackFunc) (*ParsedCommand, error)

NewParsedCommand creates a new ParsedCommand with the provided name, arguments, and callback function.

Parameters:

  • args: A map of string keys to any values representing the arguments passed to the command.
  • callbackFunc: The function to call when the command is used.

Returns:

  • *ParsedCommand: A pointer to the new ParsedCommand.
  • error: An error of type *ers.ErrInvalidParameter if the callbackFunc is nil.

Behaviors:

  • If callbackFunc is nil, NoCommandCallback is used.

func (*ParsedCommand) Execute

func (pc *ParsedCommand) Execute() error

Execute executes the callback function for the parsed command.

Returns:

  • error: An error if the callback function fails.

Jump to

Keyboard shortcuts

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