cmd

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Copyright © 2024 Daniel Rivas <danielrivasmd@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2024 danielrivasmd@gmail.com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2024 Daniel Rivas <danielrivasmd@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2024 Daniel Rivas <danielrivasmd@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2024 Daniel Rivas <danielrivasmd@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2024 danielrivasmd@gmail.com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const APP = "mbombo"
View Source
const EMAIL = "<danielrivasmd@gmail.com>"
View Source
const NAME = "Daniel Rivas"
View Source
const VERSION = "v1.0.0"

Variables

This section is empty.

Functions

func Execute

func Execute()

func GetDocs

func GetDocs() map[string]DocEntry

func GetExample

func GetExample(key string) string

func GetHelp

func GetHelp(key string) string

func GetShort

func GetShort(key string) string

func GetUse

func GetUse(key string) string

func MakeCmd

func MakeCmd(key string, run func(*cobra.Command, []string), opts ...CommandOpt) *cobra.Command

Types

type CommandOpt

type CommandOpt func(*cobra.Command)

func WithAliases

func WithAliases(aliases []string) CommandOpt

func WithArgs

func WithArgs(validator cobra.PositionalArgs) CommandOpt

func WithDisableFlagParsing

func WithDisableFlagParsing(disable bool) CommandOpt

func WithPostRun

func WithPostRun(postRun func(*cobra.Command, []string)) CommandOpt

func WithPreRun

func WithPreRun(preRun func(*cobra.Command, []string)) CommandOpt

func WithSilenceErrors

func WithSilenceErrors(silence bool) CommandOpt

func WithSilenceUsage

func WithSilenceUsage(silence bool) CommandOpt

func WithValidArgs

func WithValidArgs(args []string) CommandOpt

type DocEntry

type DocEntry struct {
	Use                   string     `json:"use"`
	Aliases               []string   `json:"aliases,omitempty"`
	Hidden                bool       `json:"hidden,omitempty"`
	Short                 string     `json:"short,omitempty"`
	Long                  string     `json:"long"`
	ExampleUsages         [][]string `json:"example_usages,omitempty"`
	ValidArgs             []string   `json:"valid_args,omitempty"`
	DisableFlagsInUseLine bool       `json:"disable_flags_in_use_line,omitempty"`
}

func GetDocEntry

func GetDocEntry(key string) (DocEntry, bool)

type Docs

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

func (*Docs) CommandExists

func (d *Docs) CommandExists(key string) bool

func (*Docs) GetAllEntries

func (d *Docs) GetAllEntries() map[string]DocEntry

func (*Docs) GetEntry

func (d *Docs) GetEntry(key string) (DocEntry, bool)

func (*Docs) GetExample

func (d *Docs) GetExample(key string) string

func (*Docs) GetHelp

func (d *Docs) GetHelp(key string) string

func (*Docs) GetShort

func (d *Docs) GetShort(key string) string

func (*Docs) GetUse

func (d *Docs) GetUse(key string) string

func (*Docs) ListCommands

func (d *Docs) ListCommands() []string

Jump to

Keyboard shortcuts

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