Documentation
¶
Index ¶
- type Completer
- func (c Completer) GameInstallSelectors(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective)
- func (c Completer) ModFileVersionIDs(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective)
- func (c Completer) ModFileVersionIDsForPage(cmd *cobra.Command, modPageArg string, toComplete string) ([]string, cobra.ShellCompDirective)
- func (c Completer) ModPageIDs(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective)
- func (c Completer) ProfileNames(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective)
- func (c Completer) StoreIDs(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective)
- func (c Completer) TargetNames(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Completer ¶ added in v0.9.0
type Completer struct {
// DatabasePath is the file of the database, which is only read.
DatabasePath string
// StateDir is the directory that the active selection is kept in.
StateDir string
}
A Completer completes what a command is given, from the database and the active selection that it is given: what it knows is what it is made with, and nothing it can find by itself, so one is made for the place that a test has set up as easily as for the one that the user has.
A completion is not allowed to fail loudly, or to fall back to the files of the directory it is in: if the database is not there, or the active game is not known, there is nothing to complete.
func (Completer) GameInstallSelectors ¶ added in v0.9.0
func (c Completer) GameInstallSelectors(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective)
GameInstallSelectors completes "games set-active <selector>". It returns *full selectors* (always includes #instance) with a description.
func (Completer) ModFileVersionIDs ¶ added in v0.9.0
func (c Completer) ModFileVersionIDs(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective)
ModFileVersionIDs completes mod file version IDs for the active (or --game-scoped) game install. Returns candidates as numeric IDs with a "Mod Page › File Label (version)" description.
func (Completer) ModFileVersionIDsForPage ¶ added in v0.9.0
func (c Completer) ModFileVersionIDsForPage(cmd *cobra.Command, modPageArg string, toComplete string) ([]string, cobra.ShellCompDirective)
ModFileVersionIDsForPage completes mod file version IDs filtered to a specific mod page. modPageArg may be a numeric ID or a name; if it is non-empty and cannot be resolved unambiguously, no completions are returned. Returns candidates as numeric IDs with a "File Label (version)" description.
func (Completer) ModPageIDs ¶ added in v0.9.0
func (c Completer) ModPageIDs(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective)
ModPageIDs completes mod page IDs for the active (or --game-scoped) game install. Returns candidates as numeric IDs with the mod page name and source kind as the description.
func (Completer) ProfileNames ¶ added in v0.9.0
func (c Completer) ProfileNames(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective)
ProfileNames completes profile names for the current game install. If the command has a --game flag set, it is used; otherwise the active game is used.
N.B. that at the moment we're using Flags() on all of the profile commands
individually (instead of PersistentFlags() on the profiles root command) which means if we ever switch to PersistentFlags we need to update here to use cmd.InheritedFlags() instead of cmd.Flags().
Returns candidates in "name\t(active)" format.
func (Completer) StoreIDs ¶ added in v0.9.0
func (c Completer) StoreIDs(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective)
StoreIDs completes (enabled) store IDs Returns candidates in "id\tDisplay Name" format.
func (Completer) TargetNames ¶ added in v0.9.0
func (c Completer) TargetNames(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective)
TargetNames completes target names for the current game install. If the command has a --game flag set, it is used; otherwise the active game is used.
Returns candidates in "name\troot_path" format so the user can see where each target points without having to run a separate command.