Skip to content

Commit

Permalink
Merge pull request #66 from blacknon/develop
Browse files Browse the repository at this point in the history
Version 0.6.1
  • Loading branch information
blacknon authored Nov 22, 2020
2 parents 79e5deb + 1b98c47 commit f4a41a4
Show file tree
Hide file tree
Showing 456 changed files with 44,051 additions and 96,611 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Meta files
*.DS_Store
*.sublime-*
.vscode

# Binary programs
/lssh
Expand Down
91 changes: 48 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ option(lssh)
OPTIONS:
--host servername, -H servername connect servername.
--file filepath, -F filepath config filepath. (default: "/Users/blacknon/.lssh.conf")
-L [bind_address:]port:remote_address:port Local port forward mode.Specify a [bind_address:]port:remote_address:port.
-R [bind_address:]port:remote_address:port Remote port forward mode.Specify a [bind_address:]port:remote_address:port.
-D port Dynamic port forward mode(Socks5). Specify a port.
-L [bind_address:]port:remote_address:port Local port forward mode.Specify a [bind_address:]port:remote_address:port. Only single connection works.
-R [bind_address:]port:remote_address:port Remote port forward mode.Specify a [bind_address:]port:remote_address:port. Only single connection works.
-D port Dynamic port forward mode(Socks5). Specify a port. Only single connection works.
-w Displays the server header when in command execution mode.
-W Not displays the server header when in command execution mode.
--not-execute, -N not execute remote command and shell.
Expand All @@ -102,19 +102,23 @@ option(lssh)
blacknon([email protected])

VERSION:
0.6.0
0.6.1

USAGE:
# connect ssh
lssh

# parallel run command in select server over ssh
# run command selected server over ssh.
lssh command...

# run command parallel in selected server over ssh.
lssh -p command...

# parallel run command in select server over ssh, do it interactively.
# run command parallel in selected server over ssh, do it in interactively shell.
lssh -s



### lscp

run command.
Expand All @@ -123,34 +127,34 @@ run command.

option(lscp)

NAME:
lscp - TUI list select and parallel scp client command.
USAGE:
lscp [options] (local|remote):from_path... (local|remote):to_path
NAME:
lscp - TUI list select and parallel scp client command.
USAGE:
lscp [options] (local|remote):from_path... (local|remote):to_path

OPTIONS:
--host value, -H value connect servernames
--list, -l print server list from config
--file value, -f value config file path (default: "/Users/blacknon/.lssh.conf")
--permission, -p copy file permission
--help, -h print this help
--version, -v print the version
OPTIONS:
--host value, -H value connect servernames
--list, -l print server list from config
--file value, -f value, -F value config file path (default: "/Users/blacknon/.lssh.conf")
--permission, -p copy file permission
--help, -h print this help
--version, -v print the version

COPYRIGHT:
blacknon([email protected])
COPYRIGHT:
blacknon([email protected])

VERSION:
0.6.0
VERSION:
0.6.1

USAGE:
# local to remote scp
lscp /path/to/local... remote:/path/to/remote
USAGE:
# local to remote scp
lscp /path/to/local... remote:/path/to/remote

# remote to local scp
lscp remote:/path/to/remote... /path/to/local
# remote to local scp
lscp remote:/path/to/remote... /path/to/local

# remote to remote scp
lscp remote:/path/to/remote... remote:/path/to/local
# remote to remote scp
lscp remote:/path/to/remote... remote:/path/to/local


### lsftp
Expand All @@ -161,25 +165,26 @@ run command.

option(lsftp)

NAME:
lsftp - TUI list select and parallel sftp client command.
USAGE:
lsftp [options]
NAME:
lsftp - TUI list select and parallel sftp client command.
USAGE:
lsftp [options]

OPTIONS:
--file value, -f value config file path (default: "/Users/blacknon/.lssh.conf")
--help, -h print this help
--version, -v print the version
OPTIONS:
--file value, -f value, -F value config file path (default: "/Users/blacknon/.lssh.conf")
--help, -h print this help
--version, -v print the version

COPYRIGHT:
blacknon([email protected])
COPYRIGHT:
blacknon([email protected])

VERSION:
0.6.0
VERSION:
0.6.1

USAGE:
# start lsftp shell
lsftp

USAGE:
# start lsftp shell
lsftp


If you specify a command as an argument, you can select multiple hosts. Select host <kbd>Tab</kbd>, select all displayed hosts <kbd>Ctrl</kbd> + <kbd>a</kbd>.
Expand Down
6 changes: 3 additions & 3 deletions cmd/lscp/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ USAGE:
app.Name = "lscp"
app.Usage = "TUI list select and parallel scp client command."
app.Copyright = "blacknon([email protected])"
app.Version = "0.6.0"
app.Version = "0.6.1"

// options
// TODO(blacknon): オプションの追加(0.6.1)
// TODO(blacknon): オプションの追加(0.7.0)
// -P <num> ... 同じホストでパラレルでファイルをコピーできるようにする。パラレル数を指定。
app.Flags = []cli.Flag{
cli.StringSliceFlag{Name: "host,H", Usage: "connect servernames"},
cli.BoolFlag{Name: "list,l", Usage: "print server list from config"},
cli.StringFlag{Name: "file,f", Value: defConf, Usage: "config file path"},
cli.StringFlag{Name: "file,f,F", Value: defConf, Usage: "config file path"},
cli.BoolFlag{Name: "permission,p", Usage: "copy file permission"},
cli.BoolFlag{Name: "help,h", Usage: "print this help"},
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/lsftp/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ USAGE:
app.Name = "lsftp"
app.Usage = "TUI list select and parallel sftp client command."
app.Copyright = "blacknon([email protected])"
app.Version = "0.6.0"
app.Version = "0.6.1"

app.Flags = []cli.Flag{
cli.StringFlag{Name: "file,f", Value: defConf, Usage: "config file path"},
cli.StringFlag{Name: "file,f,F", Value: defConf, Usage: "config file path"},
cli.BoolFlag{Name: "help,h", Usage: "print this help"},
}

Expand Down
68 changes: 32 additions & 36 deletions cmd/lssh/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ USAGE:
# connect ssh
{{.Name}}
# parallel run command in select server over ssh
# run command selected server over ssh.
{{.Name}} command...
# run command parallel in selected server over ssh.
{{.Name}} -p command...
# parallel run command in select server over ssh, do it interactively.
# run command parallel in selected server over ssh, do it in interactively shell.
{{.Name}} -s
`

Expand All @@ -60,20 +63,18 @@ USAGE:
app.Name = "lssh"
app.Usage = "TUI list select and parallel ssh client command."
app.Copyright = "blacknon([email protected])"
app.Version = "0.6.0"
app.Version = "0.6.1"

// TODO(blacknon): オプションの追加
// -f ... バックグラウンドでの接続(X11接続やport forwardingをバックグラウンドで実行する場合など)。
// 「ssh -f」と同じ。 (v0.6.1)
// 「ssh -f」と同じ。 (v0.7.0)
// (https://github.com/sevlyar/go-daemon)
// -a ... 自動接続モード(接続が切れてしまった場合、自動的に再接続を試みる)。autossh的なoptionとして追加。 (v0.6.1)
// -A <num> ... 自動接続モード(接続が切れてしまった場合、自動的に再接続を試みる)。再試行の回数指定(デフォルトは3回?)。 (v0.6.1)
// -w ... コマンド実行時にサーバ名ヘッダの表示をする (v0.6.0)
// -W ... コマンド実行時にサーバ名ヘッダの表示をしない (v0.6.0)
// -a ... 自動接続モード(接続が切れてしまった場合、自動的に再接続を試みる)。autossh的なoptionとして追加。 (v0.7.0)
// -A <num> ... 自動接続モード(接続が切れてしまった場合、自動的に再接続を試みる)。再試行の回数指定(デフォルトは3回?)。 (v0.7.0)
// --read_profile
// ... デフォルトではlocalrc読み込みでのshellではsshサーバ上のprofileは読み込まないが、このオプションを指定することで読み込まれるようになる (v0.6.1)
// ... デフォルトではlocalrc読み込みでのshellではsshサーバ上のprofileは読み込まないが、このオプションを指定することで読み込まれるようになる (v0.7.0)

// TODO(blacknon): コマンドオプションの指定方法(特にポートフォワーディング)をOpenSSHに合わせる
// TODO(blacknon): ポートフォワーディングの指定を複数指定可能にする

// Set options
app.Flags = []cli.Flag{
Expand All @@ -82,11 +83,9 @@ USAGE:
cli.StringFlag{Name: "file,F", Value: defConf, Usage: "config `filepath`."},

// port forward option
cli.StringFlag{Name: "L", Usage: "Local port forward mode.Specify a `[bind_address:]port:remote_address:port`."},
cli.StringFlag{Name: "R", Usage: "Remote port forward mode.Specify a `[bind_address:]port:remote_address:port`."},
cli.StringFlag{Name: "D", Usage: "Dynamic port forward mode(Socks5). Specify a `port`."},
// cli.StringFlag{Name: "portforward-local", Usage: "port forwarding parameter, `address:port`. use local-forward or reverse-forward. (local port(ex. 127.0.0.1:8080))."},
// cli.StringFlag{Name: "portforward-remote", Usage: "port forwarding parameter, `address:port`. use local-forward or reverse-forward. (remote port(ex. 127.0.0.1:80))."},
cli.StringSliceFlag{Name: "L", Usage: "Local port forward mode.Specify a `[bind_address:]port:remote_address:port`. Only single connection works."},
cli.StringSliceFlag{Name: "R", Usage: "Remote port forward mode.Specify a `[bind_address:]port:remote_address:port`. Only single connection works."},
cli.StringFlag{Name: "D", Usage: "Dynamic port forward mode(Socks5). Specify a `port`. Only single connection works."},

// Other bool
cli.BoolFlag{Name: "w", Usage: "Displays the server header when in command execution mode."},
Expand Down Expand Up @@ -198,25 +197,24 @@ USAGE:
r.DisableHeader = true
}

// local/remote port forwarding mode
// Set port forwards
var err error
var forwardlocal, forwardremote string
switch {
case c.String("L") != "":
r.PortForwardMode = "L"
forwardlocal, forwardremote, err = common.ParseForwardPort(c.String("L"))

case c.String("R") != "":
r.PortForwardMode = "R"
forwardlocal, forwardremote, err = common.ParseForwardPort(c.String("R"))

case c.String("L") != "" && c.String("R") != "":
r.PortForwardMode = "R"
forwardlocal, forwardremote, err = common.ParseForwardPort(c.String("R"))

default:
r.PortForwardMode = ""
var forwards []*conf.PortForward

// Set local port forwarding
for _, forwardargs := range c.StringSlice("L") {
f := new(conf.PortForward)
f.Mode = "L"
f.Local, f.Remote, err = common.ParseForwardPort(forwardargs)
forwards = append(forwards, f)
}

// Set remote port forwarding
for _, forwardargs := range c.StringSlice("R") {
f := new(conf.PortForward)
f.Mode = "R"
f.Local, f.Remote, err = common.ParseForwardPort(forwardargs)
forwards = append(forwards, f)
}

// if err
Expand All @@ -227,10 +225,8 @@ USAGE:
// is not execute
r.IsNone = c.Bool("not-execute")

// local/remote port forwarding address

r.PortForwardLocal = forwardlocal
r.PortForwardRemote = forwardremote
// Local/Remote port forwarding port
r.PortForward = forwards

// Dynamic port forwarding port
r.DynamicPortForward = c.String("D")
Expand Down
3 changes: 3 additions & 0 deletions common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ func ParseArgs(options []cli.Flag, args []string) []string {

parseloop:
for i, arg := range args[1:] {
// delete space
arg = strings.TrimSpace(arg)

switch {
case !optionReg.MatchString(arg) && !isOptionArgs:
// not option arg, and sOptinArgs flag false
Expand Down
Loading

0 comments on commit f4a41a4

Please sign in to comment.