@@ -158,12 +158,12 @@ func (l *Launcher) Context(ctx context.Context) *Launcher {
158
158
return l
159
159
}
160
160
161
- // Set a command line argument to launch the browser.
161
+ // Set a command line argument when launching the browser. Be careful the first argument is a flag name,
162
+ // it shouldn't contain values. The values the will be joined with comma.
163
+ // You can use the [Launcher.FormatArgs] to debug the final CLI arguments.
162
164
func (l * Launcher ) Set (name flags.Flag , values ... string ) * Launcher {
163
- if strings .Contains (string (name ), "=" ) {
164
- panic ("flag name should not contain '='" )
165
- }
166
- l .Flags [l .normalizeFlag (name )] = values
165
+ name .Check ()
166
+ l .Flags [name .NormalizeFlag ()] = values
167
167
return l
168
168
}
169
169
@@ -183,7 +183,7 @@ func (l *Launcher) Has(name flags.Flag) bool {
183
183
184
184
// GetFlags from settings
185
185
func (l * Launcher ) GetFlags (name flags.Flag ) ([]string , bool ) {
186
- flag , has := l .Flags [l . normalizeFlag ( name )]
186
+ flag , has := l .Flags [name . NormalizeFlag ( )]
187
187
return flag , has
188
188
}
189
189
@@ -198,7 +198,7 @@ func (l *Launcher) Append(name flags.Flag, values ...string) *Launcher {
198
198
199
199
// Delete a flag
200
200
func (l * Launcher ) Delete (name flags.Flag ) * Launcher {
201
- delete (l .Flags , l . normalizeFlag ( name ))
201
+ delete (l .Flags , name . NormalizeFlag ( ))
202
202
return l
203
203
}
204
204
@@ -488,7 +488,3 @@ func (l *Launcher) Cleanup() {
488
488
dir := l .Get (flags .UserDataDir )
489
489
_ = os .RemoveAll (dir )
490
490
}
491
-
492
- func (l * Launcher ) normalizeFlag (name flags.Flag ) flags.Flag {
493
- return flags .Flag (strings .TrimLeft (string (name ), "-" ))
494
- }
0 commit comments