summaryrefslogtreecommitdiff
path: root/cmd/gitlab-shell/command/command.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/gitlab-shell/command/command.go')
-rw-r--r--cmd/gitlab-shell/command/command.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/gitlab-shell/command/command.go b/cmd/gitlab-shell/command/command.go
index b2a0266..260e517 100644
--- a/cmd/gitlab-shell/command/command.go
+++ b/cmd/gitlab-shell/command/command.go
@@ -58,6 +58,20 @@ func NewWithKrb5Principal(gitlabKrb5Principal string, env sshenv.Env, config *co
return nil, disallowedcommand.Error
}
+func NewWithUsername(gitlabUsername string, env sshenv.Env, config *config.Config, readWriter *readwriter.ReadWriter) (command.Command, error) {
+ args, err := Parse(nil, env)
+ if err != nil {
+ return nil, err
+ }
+
+ args.GitlabUsername = gitlabUsername
+ if cmd := Build(args, config, readWriter); cmd != nil {
+ return cmd, nil
+ }
+
+ return nil, disallowedcommand.Error
+}
+
func Parse(arguments []string, env sshenv.Env) (*commandargs.Shell, error) {
args := &commandargs.Shell{Arguments: arguments, Env: env}