Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add way to fetch the unparsed command string from a session. #93

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 8 additions & 0 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ type Session interface {
// Exit sends an exit status and then closes the session.
Exit(code int) error

// RawCommand returns the command exactly as the client/user specified it.
RawCommand() string

// Command returns a shell parsed slice of arguments that were provided by the
// user. Shell parsing splits the command string according to POSIX shell rules,
// which considers quoting not just whitespace.
Expand Down Expand Up @@ -104,6 +107,7 @@ type session struct {
winch chan Window
env []string
ptyCb PtyCallback
rawCmd string
cmd []string
ctx Context
sigCh chan<- Signal
Expand Down Expand Up @@ -177,6 +181,10 @@ func (sess *session) Environ() []string {
return append([]string(nil), sess.env...)
}

func (sess *session) RawCommand() string {
return sess.rawCmd
}

func (sess *session) Command() []string {
return append([]string(nil), sess.cmd...)
}
Expand Down