Skip to content

Commit

Permalink
添加新命令sync-hostlist
Browse files Browse the repository at this point in the history
  • Loading branch information
ShixiangWang committed Sep 27, 2018
1 parent eb9be19 commit e3f06fa
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,22 @@ Usage: sync-switch -u host_name [-d] <host_ip> [-p] <host_port>
sync-switch -u wangshx -d 10.15.22.110 -p 22
```
### sync-hostlist
没有参数,列出可用和保存的所有主机列表。
```shell
$ sync-hostlist
>>> Current Host
user=wangshx
ip=10.15.22.110
port=22
>>> Available Hosts:
liuxs,10.15.22.110,22
wangshx,10.15.22.110,22
```
## 问题
有问题欢迎[提交issue](https://github.com/ShixiangWang/sync-deploy/issues)进行讨论。
18 changes: 17 additions & 1 deletion README_english.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The last command is `sync-command`, you can use it to run any commands on remote
## New feature
To easily work with multiple hosts, `sync-hostadd`, `sync-hostdel` and `sync-switch` has been added to this tool for add/delete and switch host.
To easily work with multiple hosts, `sync-hostadd`, `sync-hostdel` and `sync-switch` has been added to this tool for add/delete and switch host. `sync-hostlist` used to list current host and available hosts.
### sync-hostadd
Expand Down Expand Up @@ -99,3 +99,19 @@ Usage: sync-switch -u host_name [-d] <host_ip> [-p] <host_port>
==> examples:
sync-switch -u wangshx -d 10.15.22.110 -p 22
```
### sync-hostlist
This command has no arguments.
```shell
$ sync-hostlist
>>> Current Host
user=wangshx
ip=10.15.22.110
port=22
>>> Available Hosts:
liuxs,10.15.22.110,22
wangshx,10.15.22.110,22
```
12 changes: 12 additions & 0 deletions src/sync-hostlist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# switch server host

# locate dir of sync-deploy tool
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

echo ">>> Current Host:"
sed 's/remote_//' $DIR/syn-setting

echo
echo ">>> Available Hosts:"
cat $DIR/sync-hosts

0 comments on commit e3f06fa

Please sign in to comment.