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
33 changes: 24 additions & 9 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ type Key string

// Argument key constants for advarg struct tags and map lookups.
const (
KeyWhen Key = "when"
KeyLauncher Key = "launcher"
KeySystem Key = "system"
KeyAction Key = "action"
KeyTags Key = "tags"
KeyMode Key = "mode"
KeyName Key = "name"
KeyPreNotice Key = "pre_notice"
KeyHidden Key = "hidden"
KeyWhen Key = "when"
KeyLauncher Key = "launcher"
KeySystem Key = "system"
KeyAction Key = "action"
KeySetName Key = "set_name"
KeySetNameSameDir Key = "set_name_same_dir"
KeyTags Key = "tags"
KeyMode Key = "mode"
KeyName Key = "name"
KeyPreNotice Key = "pre_notice"
KeyHidden Key = "hidden"
)

// Action values for the action advanced argument.
Expand All @@ -69,9 +71,18 @@ type GlobalArgs struct {
When string `advarg:"when"`
}

// LaunchSetNameArgs contains optional launcher set-name advanced arguments.
type LaunchSetNameArgs struct {
// SetName specifies a platform-defined launch profile/core name override.
SetName string `advarg:"set_name"`
// SetNameSameDir controls whether SetName should keep the original game directory.
SetNameSameDir string `advarg:"set_name_same_dir"`
}

// LaunchArgs contains advanced arguments for the launch command.
type LaunchArgs struct {
GlobalArgs
LaunchSetNameArgs
// Launcher overrides the default launcher by ID.
Launcher string `advarg:"launcher" validate:"omitempty,launcher"` //nolint:revive // custom validator
// System specifies the target system for path resolution.
Expand All @@ -87,6 +98,7 @@ type LaunchArgs struct {
// LaunchRandomArgs contains advanced arguments for the launch.random command.
type LaunchRandomArgs struct {
GlobalArgs
LaunchSetNameArgs
// Launcher overrides the default launcher by ID.
Launcher string `advarg:"launcher" validate:"omitempty,launcher"` //nolint:revive // custom validator
// Action specifies the launch action (run, details).
Expand All @@ -98,6 +110,7 @@ type LaunchRandomArgs struct {
// LaunchSearchArgs contains advanced arguments for the launch.search command.
type LaunchSearchArgs struct {
GlobalArgs
LaunchSetNameArgs
// Launcher overrides the default launcher by ID.
Launcher string `advarg:"launcher" validate:"omitempty,launcher"` //nolint:revive // custom validator
// Action specifies the launch action (run, details).
Expand All @@ -109,6 +122,7 @@ type LaunchSearchArgs struct {
// LaunchTitleArgs contains advanced arguments for the launch.title command.
type LaunchTitleArgs struct {
GlobalArgs
LaunchSetNameArgs
// Launcher overrides the default launcher by ID.
Launcher string `advarg:"launcher" validate:"omitempty,launcher"` //nolint:revive // custom validator
// Action specifies the launch action (run, details).
Expand All @@ -120,6 +134,7 @@ type LaunchTitleArgs struct {
// LaunchLastArgs contains advanced arguments for the launch.last command.
type LaunchLastArgs struct {
GlobalArgs
LaunchSetNameArgs
// Launcher overrides the default launcher by ID.
Launcher string `advarg:"launcher" validate:"omitempty,launcher"` //nolint:revive // custom validator
// Action specifies the launch action (run, details).
Expand Down
47 changes: 47 additions & 0 deletions types_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright 2026 The Zaparoo Project Contributors.
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package zapscript

import "testing"

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

args := LaunchArgs{
LaunchSetNameArgs: LaunchSetNameArgs{
SetName: "RA_NES",
SetNameSameDir: "1",
},
}

if args.SetName != "RA_NES" {
t.Fatalf("SetName = %q, want %q", args.SetName, "RA_NES")
}
if args.SetNameSameDir != "1" {
t.Fatalf("SetNameSameDir = %q, want %q", args.SetNameSameDir, "1")
}
}

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

if KeySetName != "set_name" {
t.Fatalf("KeySetName = %q, want %q", KeySetName, "set_name")
}
if KeySetNameSameDir != "set_name_same_dir" {
t.Fatalf("KeySetNameSameDir = %q, want %q", KeySetNameSameDir, "set_name_same_dir")
}
}
Loading