Skip to content

Commit

Permalink
Add extended version information flag
Browse files Browse the repository at this point in the history
This will be useful when people send bug reports.
  • Loading branch information
sds committed Oct 31, 2016
1 parent 37d43b1 commit 2825e74
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Option | Description
`-f` | Force creation of new container (destroying old one if it exists)
`-q` | Silence Dock-related output (so only output from command run in the container is shown)
`-v` | Display version information
`-V` | Display extended version information (for bug reports)

### Attach to an already-running container

Expand Down
19 changes: 18 additions & 1 deletion bin/dock
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# -q Don't display any Dock-specific output (just output from
# the command you are running in the container)
# -v Display version information.
# -V Display extended version information (for bug reports)
# END USAGE DOCUMENTATION

set -euo pipefail
Expand Down Expand Up @@ -92,6 +93,18 @@ in_path() {
[ "$(type -t "$1")" = file ] && command -v "$1" >/dev/null 2>&1
}

display_debug_version_info() {
echo "Dock: $(dock_version)"
echo -n "Docker: "
if in_path docker; then
echo "$(docker --version)"
else
echo "Docker executable not found in PATH!"
fi
echo "Bash: $BASH_VERSION"
echo "OS: $(uname -v)"
}

display_usage() {
# TODO: read documentation at top of file
echo
Expand Down Expand Up @@ -542,7 +555,7 @@ fi
# Need to scan for help flag before running `check_dependencies` since user
# may be trying to just view documentation and doesn't care if dependencies are
# installed.
while getopts ":hqv" opt; do
while getopts ":hqvV" opt; do
case $opt in
h)
display_usage
Expand All @@ -555,6 +568,10 @@ while getopts ":hqv" opt; do
echo "$(dock_version)"
exit
;;
V)
display_debug_version_info
exit
;;
esac
done
OPTIND=1 # Reset index so that we can parse the arguments with getopts again
Expand Down

0 comments on commit 2825e74

Please sign in to comment.