Skip to content

Commit

Permalink
Add --remote argument (#28)
Browse files Browse the repository at this point in the history
Co-authored-by: Bjoern Petri <b.petri@link11.com>
  • Loading branch information
bpetri and bpetri authored Apr 8, 2020
1 parent dc2602c commit a5d60c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ shipit [option] <command>
| Option | Description |
| --------------- | ----------- |
| -c, --config | Config file path (default: `.shipit`) |
| -r, --remote | Override remote host |
| -v, --verbose | Enable verbose mode for SSH |

### Examples
Expand Down
10 changes: 9 additions & 1 deletion bin/shipit
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ usage() {
echo "Options:"
echo
echo " -c, --config Config file name (default: .shipit)"
echo " -r, --remote Override remote host"
echo " -v, --verbose Enable verbose mode for SSH"
echo
}
Expand Down Expand Up @@ -79,6 +80,12 @@ set_config_file() {
CONFIG_NAME="$1"
}

# Set remote host
set_remote_host() {
test -z "$1" && abort 'Hostname is required for --remote/-r option.'
SSH_HOST="$1"
}

# Print squirrel
squirrel() {
echo "$WHITE"
Expand Down Expand Up @@ -122,7 +129,7 @@ read_config() {
test -z "$host" || test -z "$path" && exit 1

# Expose params
SSH_HOST=$host
SSH_HOST="${SSH_HOST:-$host}"
SSH_PATH=$path
}

Expand Down Expand Up @@ -245,6 +252,7 @@ for arg in "$@"; do
case "$arg" in
-v|--verbose) set_verbose; shift ;;
-c|--config) set_config_file "$2"; shift; shift ;;
-r|--remote) set_remote_host "$2"; shift; shift ;;
esac
done

Expand Down

0 comments on commit a5d60c9

Please sign in to comment.