2022-02-20 00:22:03 +00:00
|
|
|
// Copyright 2022 Robert S. Muhlestein.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2022-02-17 23:10:08 +00:00
|
|
|
|
|
|
|
package comp
|
|
|
|
|
|
|
|
// Completer defines a function to complete the given leaf Command with
|
|
|
|
// the provided arguments, if any. Completer functions must never be
|
|
|
|
// passed a nil Command or nil as the args slice. See comp.Standard.
|
|
|
|
|
|
|
|
type Completer func(leaf Command, args []string) []string
|
|
|
|
|
|
|
|
// Command interface is only here to break cyclical package imports.
|
|
|
|
// This enables Completers of any kind to be create and managed
|
|
|
|
// independently.
|
|
|
|
type Command interface {
|
|
|
|
GetName() string
|
|
|
|
GetCommands() []string
|
|
|
|
GetHidden() []string
|
|
|
|
GetParams() []string
|
2022-02-24 14:02:18 +00:00
|
|
|
GetOther() map[string]string
|
2022-02-17 23:10:08 +00:00
|
|
|
GetCompleter() Completer
|
2022-02-24 14:02:18 +00:00
|
|
|
GetCaller() Command
|
2022-02-17 23:10:08 +00:00
|
|
|
}
|