UserExistsError / conpty

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

support start with working directory #5

Closed lonnywong closed 10 months ago

UserExistsError commented 10 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 10 months ago

@UserExistsError Thanks. Your approach is much better.

UserExistsError commented 10 months ago

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