UserExistsError / conpty

Windows Pseudo Console (ConPTY) for Golang
MIT License
32 stars 12 forks source link

support start with working directory #5

Closed lonnywong closed 11 months ago

UserExistsError commented 11 months ago

Thanks for the PR @lonnywong . My first thought is this may be better as a ConPtyOption, that way we don't need to introduce another API. Maybe something like this:

type conPtyArgs struct {
    coords _COORD
    workDir string
}

func ConPtyWorkDir(workDir string) ConPtyOption {
    return func(args *conPtyArgs) {
        args.workDir = workDir
    }
}

Used like this:

conpty.Start(commandLine, ConPtyWorkDir(`c:\Windows\Temp`))

What do you think?

lonnywong commented 11 months ago

@UserExistsError Thanks. Your approach is much better.

UserExistsError commented 11 months ago

I cut a new release for this: https://github.com/UserExistsError/conpty/releases/tag/v0.1.2