Documentation
¶
Overview ¶
Package argresolver turns what a command is given (a flag or an argument) into what it names, in the database of modctl, and says what is wrong when it can't. The functions are named after what they return:
- GameInstall and Profile are for a flag that can be left out, which then means the one that is active (the game install by itself, the profile of a game install);
- ExplicitGameInstall is for a game install that is always given;
- ModPage, ModFileVersion and EnabledProfileVersion are for mods, by their id or by the name of their mod page;
- ProfileItemByVersion is for the item that a version is in a profile;
- Relpath is for a path in a target, which has no database to look in but has to be inside of it.
Index ¶
- func EnabledProfileVersion(ctx context.Context, q *dbq.Queries, gi dbq.GameInstall, profile dbq.Profile, ...) (int64, error)
- func ExplicitGameInstall(ctx context.Context, q *dbq.Queries, arg string) (dbq.GameInstall, error)
- func GameInstall(ctx context.Context, q *dbq.Queries, stateDir string, arg string) (dbq.GameInstall, error)
- func ModFileVersion(ctx context.Context, q *dbq.Queries, gi dbq.GameInstall, arg string) (dbq.GetModFileVersionByIDRow, error)
- func ModPage(ctx context.Context, q *dbq.Queries, gi dbq.GameInstall, arg string) (dbq.GetModPageByIDForGameRow, error)
- func Profile(ctx context.Context, q *dbq.Queries, gi dbq.GameInstall, arg string) (dbq.Profile, error)
- func ProfileItemByVersion(ctx context.Context, q *dbq.Queries, profile dbq.Profile, versionID int64) (int64, error)
- func Relpath(arg string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnabledProfileVersion ¶ added in v0.9.0
func EnabledProfileVersion(ctx context.Context, q *dbq.Queries, gi dbq.GameInstall, profile dbq.Profile, arg string) (int64, error)
EnabledProfileVersion resolves a mod file version argument for a command that acts on the enabled version of a mod in a profile (e.g., disable). It behaves like ModFileVersion except that when the argument is a mod page name matching several versions, the candidates are narrowed to the versions that are enabled in the given profile:
- exactly one enabled version: that version is returned
- several enabled versions: an error listing only those is returned
- none enabled: resolution falls back to ModFileVersion so the usual not-in-profile/already-disabled/ambiguity handling applies
func ExplicitGameInstall ¶ added in v0.9.0
func GameInstall ¶ added in v0.9.0
func GameInstall(ctx context.Context, q *dbq.Queries, stateDir string, arg string) (dbq.GameInstall, error)
GameInstall resolves the game install that a command is for: the one that arg says (see ExplicitGameInstall), or the active one, from the state directory stateDir, if arg is empty, which is what leaving out --game means.
func ModFileVersion ¶ added in v0.9.0
func ModFileVersion(ctx context.Context, q *dbq.Queries, gi dbq.GameInstall, arg string) (dbq.GetModFileVersionByIDRow, error)
ModFileVersion resolves a mod file version argument for the given game install. Accepts:
- a numeric ID (fast path, unambiguous)
- a mod page name (case-insensitive; errors if ambiguous, listing all candidates with their numeric IDs)
func ModPage ¶ added in v0.9.0
func ModPage(ctx context.Context, q *dbq.Queries, gi dbq.GameInstall, arg string) (dbq.GetModPageByIDForGameRow, error)
ModPage resolves a mod page argument for the given game install. Accepts:
- a numeric ID (fast path, unambiguous)
- a mod page name (case-insensitive; errors if ambiguous, listing all candidates with their numeric IDs)
func Profile ¶ added in v0.9.0
func Profile(ctx context.Context, q *dbq.Queries, gi dbq.GameInstall, arg string) (dbq.Profile, error)
Profile resolves the profile that a command is for: the one of the game install that arg names, or its active profile when arg is empty (which is what leaving out --profile means).
func ProfileItemByVersion ¶ added in v0.9.0
func ProfileItemByVersion(ctx context.Context, q *dbq.Queries, profile dbq.Profile, versionID int64) (int64, error)
ProfileItemByVersion looks up a profile item by mod file version ID within a profile, returning a clean error if the version is not in the profile.
func Relpath ¶ added in v0.9.0
Relpath is the path that a command is given as an argument for a file in a target, such as the file of a backup or an override, made ready to be looked up: cleaned, and as the path that is relative to the root of the target that it has to be. A path that is not one (it is absolute, it gets out of the root by way of "..", or it is the root itself) is an error that says what is wrong with it, as it was typed.
Types ¶
This section is empty.