Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const (
KeyAction Key = "action"
KeySetName Key = "set_name"
KeySetNameSameDir Key = "set_name_same_dir"
KeySlot Key = "slot"
KeyTags Key = "tags"
KeyMode Key = "mode"
KeyName Key = "name"
Expand Down Expand Up @@ -84,6 +85,8 @@ type LaunchArgs struct {
System string `advarg:"system" validate:"omitempty,system"` //nolint:revive // custom validator
// Action specifies the launch action (run, details).
Action string `advarg:"action" validate:"omitempty,oneof=run details"`
// Slot selects the media slot for launch routing.
Slot string `advarg:"slot"`
// Name is the filename for remote file installation.
Name string `advarg:"name"`
// PreNotice is shown before remote file download.
Expand All @@ -101,6 +104,8 @@ type LaunchRandomArgs struct {
Launcher string `advarg:"launcher" validate:"omitempty,launcher"` //nolint:revive // custom validator
// Action specifies the launch action (run, details).
Action string `advarg:"action" validate:"omitempty,oneof=run details"`
// Slot selects the media slot for launch routing.
Slot string `advarg:"slot"`
// Tags filters results by tag criteria.
Tags []TagFilter `advarg:"tags"`
}
Expand All @@ -116,6 +121,8 @@ type LaunchSearchArgs struct {
Launcher string `advarg:"launcher" validate:"omitempty,launcher"` //nolint:revive // custom validator
// Action specifies the launch action (run, details).
Action string `advarg:"action" validate:"omitempty,oneof=run details"`
// Slot selects the media slot for launch routing.
Slot string `advarg:"slot"`
// Tags filters results by tag criteria.
Tags []TagFilter `advarg:"tags"`
}
Expand All @@ -131,6 +138,8 @@ type LaunchTitleArgs struct {
Launcher string `advarg:"launcher" validate:"omitempty,launcher"` //nolint:revive // custom validator
// Action specifies the launch action (run, details).
Action string `advarg:"action" validate:"omitempty,oneof=run details"`
// Slot selects the media slot for launch routing.
Slot string `advarg:"slot"`
// Tags filters results by tag criteria.
Tags []TagFilter `advarg:"tags"`
}
Expand All @@ -146,13 +155,17 @@ type LaunchLastArgs struct {
Launcher string `advarg:"launcher" validate:"omitempty,launcher"` //nolint:revive // custom validator
// Action specifies the launch action (run, details).
Action string `advarg:"action" validate:"omitempty,oneof=run details"`
// Slot selects the media slot for launch routing.
Slot string `advarg:"slot"`
}

// PlaylistArgs contains advanced arguments for playlist commands.
type PlaylistArgs struct {
GlobalArgs
// Mode controls playlist behavior (e.g., "shuffle").
Mode string `advarg:"mode" validate:"omitempty,oneof=shuffle"`
// Slot selects the media slot for playlist routing.
Slot string `advarg:"slot"`
}

// MisterScriptArgs contains advanced arguments for MiSTer script commands.
Expand Down
11 changes: 11 additions & 0 deletions types_advargs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ func TestLaunchArgsSetNameAdvargFields(t *testing.T) {
requireAdvargField(t, reflect.TypeOf(LaunchLastArgs{}), "set_name_same_dir")
}

func TestSlotAdvargFields(t *testing.T) {
t.Parallel()

requireAdvargField(t, reflect.TypeOf(LaunchArgs{}), "slot")
requireAdvargField(t, reflect.TypeOf(LaunchRandomArgs{}), "slot")
requireAdvargField(t, reflect.TypeOf(LaunchSearchArgs{}), "slot")
requireAdvargField(t, reflect.TypeOf(LaunchTitleArgs{}), "slot")
requireAdvargField(t, reflect.TypeOf(LaunchLastArgs{}), "slot")
requireAdvargField(t, reflect.TypeOf(PlaylistArgs{}), "slot")
}

func requireAdvargField(t *testing.T, typ reflect.Type, tag string) {
t.Helper()

Expand Down
8 changes: 8 additions & 0 deletions types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ func TestLaunchSetNameKeys(t *testing.T) {
t.Fatalf("KeySetNameSameDir = %q, want %q", KeySetNameSameDir, "set_name_same_dir")
}
}

func TestSlotKey(t *testing.T) {
t.Parallel()

if KeySlot != "slot" {
t.Fatalf("KeySlot = %q, want %q", KeySlot, "slot")
}
}
Loading