Skip to content

Commit

Permalink
Merge pull request #84 from blacknon/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
blacknon authored Feb 16, 2022
2 parents 9397205 + 622eddc commit 19a8e26
Show file tree
Hide file tree
Showing 25 changed files with 185 additions and 97 deletions.
2 changes: 1 addition & 1 deletion cmd/lscp/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ USAGE:
app.Name = "lscp"
app.Usage = "TUI list select and parallel scp client command."
app.Copyright = "blacknon([email protected])"
app.Version = "0.6.5"
app.Version = "0.6.6"

// options
// TODO(blacknon): オプションの追加(0.7.0)
Expand Down
2 changes: 1 addition & 1 deletion cmd/lsftp/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ USAGE:
app.Name = "lsftp"
app.Usage = "TUI list select and parallel sftp client command."
app.Copyright = "blacknon([email protected])"
app.Version = "0.6.5"
app.Version = "0.6.6"

app.Flags = []cli.Flag{
cli.StringFlag{Name: "file,F", Value: defConf, Usage: "config file path"},
Expand Down
2 changes: 1 addition & 1 deletion cmd/lssh/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ USAGE:
app.Name = "lssh"
app.Usage = "TUI list select and parallel ssh client command."
app.Copyright = "blacknon([email protected])"
app.Version = "0.6.5"
app.Version = "0.6.6"

// TODO(blacknon): オプションの追加
// -f ... バックグラウンドでの接続(X11接続やport forwardingをバックグラウンドで実行する場合など)。
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require (
github.com/BurntSushi/toml v0.3.1
github.com/blacknon/go-sshlib v0.1.5
github.com/blacknon/textcol v0.0.1
github.com/c-bata/go-prompt v0.2.6
github.com/c-bata/go-prompt v0.2.5
github.com/dustin/go-humanize v1.0.0
github.com/kevinburke/ssh_config v0.0.0-20190724205821-6cfae18c12b8
github.com/mattn/go-runewidth v0.0.13
Expand Down Expand Up @@ -36,7 +36,7 @@ require (
github.com/mattn/go-tty v0.0.3 // indirect
github.com/miekg/pkcs11 v1.1.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/term v1.2.0-beta.2 // indirect
github.com/pkg/term v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/thales-e-security/pool v0.0.2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ github.com/blacknon/go-sshlib v0.1.5 h1:nHuIi022DS72kf5/WTBRE15NHW43Qb+1umM76Gms
github.com/blacknon/go-sshlib v0.1.5/go.mod h1:sgMpYTYseacjT4Bt9pPwjMd+eMXsLGCjDtoFugXKYDE=
github.com/blacknon/textcol v0.0.1 h1:x9h7yLPGyr8Pdz12XJ30h7Iz5mJlKd0CzfGYxhrmnk8=
github.com/blacknon/textcol v0.0.1/go.mod h1:1x1tHA4cEgiQ8BsKysc60OALSZMG9WjmbjmJvPqIInQ=
github.com/c-bata/go-prompt v0.2.6 h1:POP+nrHE+DfLYx370bedwNhsqmpCUynWPxuHi0C5vZI=
github.com/c-bata/go-prompt v0.2.6/go.mod h1:/LMAke8wD2FsNu9EXNdHxNLbd9MedkPnCdfpU9wwHfY=
github.com/c-bata/go-prompt v0.2.5 h1:3zg6PecEywxNn0xiqcXHD96fkbxghD+gdB2tbsYfl+Y=
github.com/c-bata/go-prompt v0.2.5/go.mod h1:vFnjEGDIIA/Lib7giyE4E9c50Lvl8j0S+7FVlAwDAVw=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a h1:saTgr5tMLFnmy/yg3qDTft4rE5DY2uJ/cCxCe3q0XTU=
Expand Down Expand Up @@ -58,8 +58,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.10.1 h1:VasscCm72135zRysgrJDKsntdmPN+OuU3+nnHYA9wyc=
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
github.com/pkg/term v1.2.0-beta.2 h1:L3y/h2jkuBVFdWiJvNfYfKmzcCnILw7mJWm2JQuMppw=
github.com/pkg/term v1.2.0-beta.2/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw=
github.com/pkg/term v1.1.0 h1:xIAAdCMh3QIAy+5FrE8Ad8XoDhEU4ufwbaSozViP9kk=
github.com/pkg/term v1.1.0/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
Expand Down
34 changes: 16 additions & 18 deletions output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,34 +221,32 @@ func OutColorStrings(num int, inStrings string) (str string) {
// PushInput is Reader([io.PipeReader, os.Stdin]) to []io.WriteCloser.
func PushInput(isExit <-chan bool, output []io.WriteCloser, input io.Reader) {
rd := bufio.NewReader(input)

loop:
for {
buf := make([]byte, 1024)
size, err := rd.Read(buf)

if size > 0 {
d := buf[:size]
select {
case <-isExit:
break loop
case <-time.After(10 * time.Millisecond):
if size > 0 {
d := buf[:size]

// write
for _, w := range output {
w.Write(d)
// write
for _, w := range output {
w.Write(d)
}
}
}

if input != os.Stdin {
switch err {
case nil:
continue
case io.ErrClosedPipe, io.EOF:
break loop
if input != os.Stdin {
switch err {
case io.ErrClosedPipe, io.EOF:
break loop
}
}
}

select {
case <-isExit:
break loop
case <-time.After(10 * time.Millisecond):
continue
}
}

Expand Down
19 changes: 6 additions & 13 deletions ssh/pshell_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,17 +297,7 @@ func (ps *pShell) executeRemotePipeLine(pline pipeLine, in *io.PipeReader, out *
}

// multi input-writer
switch stdin.(type) {
case *os.File:
// push input to pararell session
// (Only when input is os.Stdin and output is os.Stdout).
if stdout == os.Stdout {
// go output.PushInput(exitInput, writers, byte('\n'))
go output.PushInput(exitInput, writers, stdin)
}
case *io.PipeReader:
go output.PushInput(exitInput, writers, stdin)
}
go output.PushInput(exitInput, writers, stdin)

// run command
for _, s := range sessions {
Expand Down Expand Up @@ -336,14 +326,14 @@ func (ps *pShell) executeRemotePipeLine(pline pipeLine, in *io.PipeReader, out *
// wait
ps.wait(len(sessions), exit)

// wait time (0.500 sec)
// wait time (0.050 sec)
time.Sleep(500 * time.Millisecond)

// send exit
ch <- true

// exit input.
if stdin == os.Stdin && stdout == os.Stdout {
if stdin == os.Stdin {
exitInput <- true
}

Expand All @@ -353,6 +343,9 @@ func (ps *pShell) executeRemotePipeLine(pline pipeLine, in *io.PipeReader, out *
out.CloseWithError(io.ErrClosedPipe)
}

// wait time (0.050 sec)
time.Sleep(500 * time.Millisecond)

return
}

Expand Down
2 changes: 0 additions & 2 deletions vendor/github.com/c-bata/go-prompt/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/c-bata/go-prompt/internal/term/raw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions vendor/github.com/c-bata/go-prompt/internal/term/term.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions vendor/github.com/pkg/term/termios/ioctl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions vendor/github.com/pkg/term/termios/ioctl_darwin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions vendor/github.com/pkg/term/termios/ioctl_solaris.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions vendor/github.com/pkg/term/termios/pty_darwin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions vendor/github.com/pkg/term/termios/pty_freebsd.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions vendor/github.com/pkg/term/termios/pty_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion vendor/github.com/pkg/term/termios/pty_netbsd.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions vendor/github.com/pkg/term/termios/pty_solaris.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions vendor/github.com/pkg/term/termios/termios.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 19a8e26

Please sign in to comment.