summaryrefslogtreecommitdiff
path: root/vendor/github.com/urfave/cli/v2/category.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-12-07 13:31:39 +0100
committerLibravatar GitHub <noreply@github.com>2021-12-07 13:31:39 +0100
commit0884f89431cd26bcc9674b3b7ab628b090f5881e (patch)
treecdd3b3f77f780a8b59d075dbcc3d4d013811e405 /vendor/github.com/urfave/cli/v2/category.go
parentUpdate dependencies (#333) (diff)
downloadgotosocial-0884f89431cd26bcc9674b3b7ab628b090f5881e.tar.xz
Implement Cobra CLI tooling, Viper config tooling (#336)
* start pulling out + replacing urfave and config * replace many many instances of config * move more stuff => viper * properly remove urfave * move some flags to root command * add testrig commands to root * alias config file keys * start adding cli parsing tests * reorder viper init * remove config path alias * fmt * change config file keys to non-nested * we're more or less in business now * tidy up the common func * go fmt * get tests passing again * add note about the cliparsing tests * reorganize * update docs with changes * structure cmd dir better * rename + move some files around * fix dangling comma
Diffstat (limited to 'vendor/github.com/urfave/cli/v2/category.go')
-rw-r--r--vendor/github.com/urfave/cli/v2/category.go79
1 files changed, 0 insertions, 79 deletions
diff --git a/vendor/github.com/urfave/cli/v2/category.go b/vendor/github.com/urfave/cli/v2/category.go
deleted file mode 100644
index 867e3908c..000000000
--- a/vendor/github.com/urfave/cli/v2/category.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package cli
-
-// CommandCategories interface allows for category manipulation
-type CommandCategories interface {
- // AddCommand adds a command to a category, creating a new category if necessary.
- AddCommand(category string, command *Command)
- // categories returns a copy of the category slice
- Categories() []CommandCategory
-}
-
-type commandCategories []*commandCategory
-
-func newCommandCategories() CommandCategories {
- ret := commandCategories([]*commandCategory{})
- return &ret
-}
-
-func (c *commandCategories) Less(i, j int) bool {
- return lexicographicLess((*c)[i].Name(), (*c)[j].Name())
-}
-
-func (c *commandCategories) Len() int {
- return len(*c)
-}
-
-func (c *commandCategories) Swap(i, j int) {
- (*c)[i], (*c)[j] = (*c)[j], (*c)[i]
-}
-
-func (c *commandCategories) AddCommand(category string, command *Command) {
- for _, commandCategory := range []*commandCategory(*c) {
- if commandCategory.name == category {
- commandCategory.commands = append(commandCategory.commands, command)
- return
- }
- }
- newVal := append(*c,
- &commandCategory{name: category, commands: []*Command{command}})
- *c = newVal
-}
-
-func (c *commandCategories) Categories() []CommandCategory {
- ret := make([]CommandCategory, len(*c))
- for i, cat := range *c {
- ret[i] = cat
- }
- return ret
-}
-
-// CommandCategory is a category containing commands.
-type CommandCategory interface {
- // Name returns the category name string
- Name() string
- // VisibleCommands returns a slice of the Commands with Hidden=false
- VisibleCommands() []*Command
-}
-
-type commandCategory struct {
- name string
- commands []*Command
-}
-
-func (c *commandCategory) Name() string {
- return c.name
-}
-
-func (c *commandCategory) VisibleCommands() []*Command {
- if c.commands == nil {
- c.commands = []*Command{}
- }
-
- var ret []*Command
- for _, command := range c.commands {
- if !command.Hidden {
- ret = append(ret, command)
- }
- }
- return ret
-}