@@ -256,112 +256,112 @@ func TestParseSuccess(t *testing.T) {
256
256
executable : & executable.Executable {Name : executable .GitlabShell },
257
257
env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" },
258
258
arguments : []string {},
259
- expectedArgs : & commandargs.Shell {Arguments : []string {}, SshArgs : []string {}, CommandType : commandargs .Discover , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
259
+ expectedArgs : & commandargs.Shell {Arguments : []string {}, SSHArgs : []string {}, CommandType : commandargs .Discover , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
260
260
},
261
261
{
262
262
desc : "It finds the key id in any passed arguments" ,
263
263
executable : & executable.Executable {Name : executable .GitlabShell },
264
264
env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" },
265
265
arguments : []string {"hello" , "key-123" },
266
- expectedArgs : & commandargs.Shell {Arguments : []string {"hello" , "key-123" }, SshArgs : []string {}, CommandType : commandargs .Discover , GitlabKeyId : "123" , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
266
+ expectedArgs : & commandargs.Shell {Arguments : []string {"hello" , "key-123" }, SSHArgs : []string {}, CommandType : commandargs .Discover , GitlabKeyID : "123" , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
267
267
},
268
268
{
269
269
desc : "It finds the key id only if the argument is of <key-id> format" ,
270
270
executable : & executable.Executable {Name : executable .GitlabShell },
271
271
env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" },
272
272
arguments : []string {"hello" , "username-key-123" },
273
- expectedArgs : & commandargs.Shell {Arguments : []string {"hello" , "username-key-123" }, SshArgs : []string {}, CommandType : commandargs .Discover , GitlabUsername : "key-123" , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
273
+ expectedArgs : & commandargs.Shell {Arguments : []string {"hello" , "username-key-123" }, SSHArgs : []string {}, CommandType : commandargs .Discover , GitlabUsername : "key-123" , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
274
274
},
275
275
{
276
276
desc : "It finds the key id if the key is listed as the last argument" ,
277
277
executable : & executable.Executable {Name : executable .GitlabShell },
278
278
env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" },
279
279
arguments : []string {"hello" , "gitlab-shell -c key-123" },
280
- expectedArgs : & commandargs.Shell {Arguments : []string {"hello" , "gitlab-shell -c key-123" }, SshArgs : []string {}, CommandType : commandargs .Discover , GitlabKeyId : "123" , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
280
+ expectedArgs : & commandargs.Shell {Arguments : []string {"hello" , "gitlab-shell -c key-123" }, SSHArgs : []string {}, CommandType : commandargs .Discover , GitlabKeyID : "123" , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
281
281
},
282
282
{
283
283
desc : "It finds the username if the username is listed as the last argument" ,
284
284
executable : & executable.Executable {Name : executable .GitlabShell },
285
285
env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" },
286
286
arguments : []string {"hello" , "gitlab-shell -c username-jane-doe" },
287
- expectedArgs : & commandargs.Shell {Arguments : []string {"hello" , "gitlab-shell -c username-jane-doe" }, SshArgs : []string {}, CommandType : commandargs .Discover , GitlabUsername : "jane-doe" , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
287
+ expectedArgs : & commandargs.Shell {Arguments : []string {"hello" , "gitlab-shell -c username-jane-doe" }, SSHArgs : []string {}, CommandType : commandargs .Discover , GitlabUsername : "jane-doe" , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
288
288
},
289
289
{
290
290
desc : "It finds the key id only if the last argument is of <key-id> format" ,
291
291
executable : & executable.Executable {Name : executable .GitlabShell },
292
292
env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" },
293
293
arguments : []string {"hello" , "gitlab-shell -c username-key-123" },
294
- expectedArgs : & commandargs.Shell {Arguments : []string {"hello" , "gitlab-shell -c username-key-123" }, SshArgs : []string {}, CommandType : commandargs .Discover , GitlabUsername : "key-123" , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
294
+ expectedArgs : & commandargs.Shell {Arguments : []string {"hello" , "gitlab-shell -c username-key-123" }, SSHArgs : []string {}, CommandType : commandargs .Discover , GitlabUsername : "key-123" , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
295
295
},
296
296
{
297
297
desc : "It finds the username in any passed arguments" ,
298
298
executable : & executable.Executable {Name : executable .GitlabShell },
299
299
env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" },
300
300
arguments : []string {"hello" , "username-jane-doe" },
301
- expectedArgs : & commandargs.Shell {Arguments : []string {"hello" , "username-jane-doe" }, SshArgs : []string {}, CommandType : commandargs .Discover , GitlabUsername : "jane-doe" , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
301
+ expectedArgs : & commandargs.Shell {Arguments : []string {"hello" , "username-jane-doe" }, SSHArgs : []string {}, CommandType : commandargs .Discover , GitlabUsername : "jane-doe" , Env : sshenv.Env {IsSSHConnection : true , RemoteAddr : "1" }},
302
302
},
303
303
{
304
304
desc : "It parses 2fa_recovery_codes command" ,
305
305
executable : & executable.Executable {Name : executable .GitlabShell },
306
306
env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "2fa_recovery_codes" },
307
307
arguments : []string {},
308
- expectedArgs : & commandargs.Shell {Arguments : []string {}, SshArgs : []string {"2fa_recovery_codes" }, CommandType : commandargs .TwoFactorRecover , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "2fa_recovery_codes" }},
308
+ expectedArgs : & commandargs.Shell {Arguments : []string {}, SSHArgs : []string {"2fa_recovery_codes" }, CommandType : commandargs .TwoFactorRecover , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "2fa_recovery_codes" }},
309
309
},
310
310
{
311
311
desc : "It parses git-receive-pack command" ,
312
312
executable : & executable.Executable {Name : executable .GitlabShell },
313
313
env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-receive-pack group/repo" },
314
314
arguments : []string {},
315
- expectedArgs : & commandargs.Shell {Arguments : []string {}, SshArgs : []string {"git-receive-pack" , "group/repo" }, CommandType : commandargs .ReceivePack , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-receive-pack group/repo" }},
315
+ expectedArgs : & commandargs.Shell {Arguments : []string {}, SSHArgs : []string {"git-receive-pack" , "group/repo" }, CommandType : commandargs .ReceivePack , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-receive-pack group/repo" }},
316
316
},
317
317
{
318
318
desc : "It parses git-receive-pack command and a project with single quotes" ,
319
319
executable : & executable.Executable {Name : executable .GitlabShell },
320
320
env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-receive-pack 'group/repo'" },
321
321
arguments : []string {},
322
- expectedArgs : & commandargs.Shell {Arguments : []string {}, SshArgs : []string {"git-receive-pack" , "group/repo" }, CommandType : commandargs .ReceivePack , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-receive-pack 'group/repo'" }},
322
+ expectedArgs : & commandargs.Shell {Arguments : []string {}, SSHArgs : []string {"git-receive-pack" , "group/repo" }, CommandType : commandargs .ReceivePack , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-receive-pack 'group/repo'" }},
323
323
},
324
324
{
325
325
desc : `It parses "git receive-pack" command` ,
326
326
executable : & executable.Executable {Name : executable .GitlabShell },
327
327
env : sshenv.Env {IsSSHConnection : true , OriginalCommand : `git-receive-pack "group/repo"` },
328
328
arguments : []string {},
329
- expectedArgs : & commandargs.Shell {Arguments : []string {}, SshArgs : []string {"git-receive-pack" , "group/repo" }, CommandType : commandargs .ReceivePack , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : `git-receive-pack "group/repo"` }},
329
+ expectedArgs : & commandargs.Shell {Arguments : []string {}, SSHArgs : []string {"git-receive-pack" , "group/repo" }, CommandType : commandargs .ReceivePack , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : `git-receive-pack "group/repo"` }},
330
330
},
331
331
{
332
332
desc : `It parses a command followed by control characters` ,
333
333
executable : & executable.Executable {Name : executable .GitlabShell },
334
334
env : sshenv.Env {IsSSHConnection : true , OriginalCommand : `git-receive-pack group/repo; any command` },
335
335
arguments : []string {},
336
- expectedArgs : & commandargs.Shell {Arguments : []string {}, SshArgs : []string {"git-receive-pack" , "group/repo" }, CommandType : commandargs .ReceivePack , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : `git-receive-pack group/repo; any command` }},
336
+ expectedArgs : & commandargs.Shell {Arguments : []string {}, SSHArgs : []string {"git-receive-pack" , "group/repo" }, CommandType : commandargs .ReceivePack , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : `git-receive-pack group/repo; any command` }},
337
337
},
338
338
{
339
339
desc : "It parses git-upload-pack command" ,
340
340
executable : & executable.Executable {Name : executable .GitlabShell },
341
341
env : sshenv.Env {IsSSHConnection : true , OriginalCommand : `git upload-pack "group/repo"` },
342
342
arguments : []string {},
343
- expectedArgs : & commandargs.Shell {Arguments : []string {}, SshArgs : []string {"git-upload-pack" , "group/repo" }, CommandType : commandargs .UploadPack , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : `git upload-pack "group/repo"` }},
343
+ expectedArgs : & commandargs.Shell {Arguments : []string {}, SSHArgs : []string {"git-upload-pack" , "group/repo" }, CommandType : commandargs .UploadPack , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : `git upload-pack "group/repo"` }},
344
344
},
345
345
{
346
346
desc : "It parses git-upload-archive command" ,
347
347
executable : & executable.Executable {Name : executable .GitlabShell },
348
348
env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-upload-archive 'group/repo'" },
349
349
arguments : []string {},
350
- expectedArgs : & commandargs.Shell {Arguments : []string {}, SshArgs : []string {"git-upload-archive" , "group/repo" }, CommandType : commandargs .UploadArchive , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-upload-archive 'group/repo'" }},
350
+ expectedArgs : & commandargs.Shell {Arguments : []string {}, SSHArgs : []string {"git-upload-archive" , "group/repo" }, CommandType : commandargs .UploadArchive , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-upload-archive 'group/repo'" }},
351
351
},
352
352
{
353
353
desc : "It parses git-lfs-authenticate command" ,
354
354
executable : & executable.Executable {Name : executable .GitlabShell },
355
355
env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-lfs-authenticate 'group/repo' download" },
356
356
arguments : []string {},
357
- expectedArgs : & commandargs.Shell {Arguments : []string {}, SshArgs : []string {"git-lfs-authenticate" , "group/repo" , "download" }, CommandType : commandargs .LfsAuthenticate , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-lfs-authenticate 'group/repo' download" }},
357
+ expectedArgs : & commandargs.Shell {Arguments : []string {}, SSHArgs : []string {"git-lfs-authenticate" , "group/repo" , "download" }, CommandType : commandargs .LfsAuthenticate , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-lfs-authenticate 'group/repo' download" }},
358
358
},
359
359
{
360
360
desc : "It parses git-lfs-transfer command" ,
361
361
executable : & executable.Executable {Name : executable .GitlabShell },
362
362
env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-lfs-transfer 'group/repo' download" },
363
363
arguments : []string {},
364
- expectedArgs : & commandargs.Shell {Arguments : []string {}, SshArgs : []string {"git-lfs-transfer" , "group/repo" , "download" }, CommandType : commandargs .LfsTransfer , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-lfs-transfer 'group/repo' download" }},
364
+ expectedArgs : & commandargs.Shell {Arguments : []string {}, SSHArgs : []string {"git-lfs-transfer" , "group/repo" , "download" }, CommandType : commandargs .LfsTransfer , Env : sshenv.Env {IsSSHConnection : true , OriginalCommand : "git-lfs-transfer 'group/repo' download" }},
365
365
},
366
366
}
367
367
@@ -427,7 +427,7 @@ func TestNewWithUsername(t *testing.T) {
427
427
Args : & commandargs.Shell {
428
428
CommandType : commandargs .ReceivePack ,
429
429
GitlabUsername : "username" ,
430
- SshArgs : []string {"git-receive-pack" , "group/repo" },
430
+ SSHArgs : []string {"git-receive-pack" , "group/repo" },
431
431
Env : sshenv.Env {
432
432
IsSSHConnection : true ,
433
433
OriginalCommand : "git-receive-pack 'group/repo'" ,
@@ -442,7 +442,7 @@ func TestNewWithUsername(t *testing.T) {
442
442
Args : & commandargs.Shell {
443
443
CommandType : commandargs .TwoFactorRecover ,
444
444
GitlabUsername : "username" ,
445
- SshArgs : []string {"2fa_recovery_codes" },
445
+ SSHArgs : []string {"2fa_recovery_codes" },
446
446
Env : sshenv.Env {
447
447
IsSSHConnection : true ,
448
448
OriginalCommand : "2fa_recovery_codes" ,
@@ -463,7 +463,7 @@ func TestNewWithUsername(t *testing.T) {
463
463
Args : & commandargs.Shell {
464
464
CommandType : commandargs .ReceivePack ,
465
465
GitlabUsername : "username" ,
466
- SshArgs : []string {"git-receive-pack" , "group/repo" },
466
+ SSHArgs : []string {"git-receive-pack" , "group/repo" },
467
467
Env : sshenv.Env {
468
468
IsSSHConnection : true ,
469
469
OriginalCommand : "git-receive-pack 'group/repo'" ,
0 commit comments