You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by wi...@apache.org on 2020/08/17 11:53:30 UTC

[incubator-streampipes-installer] branch new_installer updated: [STREAMPIPES-196] add version option

This is an automated email from the ASF dual-hosted git repository.

wiener pushed a commit to branch new_installer
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes-installer.git


The following commit(s) were added to refs/heads/new_installer by this push:
     new 83320b2  [STREAMPIPES-196] add version option
83320b2 is described below

commit 83320b2044876027fb33061dba80e796dde47f70
Author: Patrick Wiener <wi...@fzi.de>
AuthorDate: Mon Aug 17 13:53:16 2020 +0200

    [STREAMPIPES-196] add version option
---
 cli/README.md         |  3 +++
 cli/bin/commands/info |  2 +-
 cli/bin/common        |  4 ++++
 cli/streampipes       | 10 +++++++---
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/cli/README.md b/cli/README.md
index b74c9a7..858f54c 100644
--- a/cli/README.md
+++ b/cli/README.md
@@ -124,6 +124,9 @@ Simply add the path the cli directory to your `$PATH` variable, e.g. in your `.b
 export PATH="/path/to/incubator-streampipes-installer/cli:$PATH"
 ```
 
+## Upgrade to new version
+To upgrade to a new version, simply edit the version tag in `VERSION`.
+
 ## Get help
 If you have any problems during the installation or questions around StreamPipes, you'll get help through one of our community channels:
 
diff --git a/cli/bin/commands/info b/cli/bin/commands/info
index 92bd278..75b39ac 100755
--- a/cli/bin/commands/info
+++ b/cli/bin/commands/info
@@ -33,7 +33,7 @@ if [ "$#" -gt 1 ]; then
 fi
 
 cat <<EOF
-Version:      $(cat $STREAMPIPES_WORKDIR/VERSION), build $(git --git-dir "$(dirname "$STREAMPIPES_WORKDIR")/.git" rev-parse --short HEAD)
+Version:      $(show_version)
 GitHub:       https://github.com/apache/incubator-streampipes-installer
 Website:      https://streampipes.apache.org
 Bug Report:   dev@streampipes.apache.org
diff --git a/cli/bin/common b/cli/bin/common
index 4f435f8..a443108 100644
--- a/cli/bin/common
+++ b/cli/bin/common
@@ -31,6 +31,10 @@ fatal(){
   exit 1
 }
 
+show_version(){
+  echo $(cat $STREAMPIPES_WORKDIR/VERSION), build $(git --git-dir "$(dirname "$STREAMPIPES_WORKDIR")/.git" rev-parse --short HEAD)
+}
+
 show_banner(){
   cat <<EOF
   _______ __                              ______ __
diff --git a/cli/streampipes b/cli/streampipes
index 527dc11..7370c5b 100755
--- a/cli/streampipes
+++ b/cli/streampipes
@@ -22,13 +22,14 @@ cli_help() {
   cat <<EOF
 StreamPipes CLI - Manage your StreamPipes environment with ease
 
-Version:      $(cat $STREAMPIPES_WORKDIR/VERSION), build $(git --git-dir "$(dirname "$STREAMPIPES_WORKDIR")/.git" rev-parse --short HEAD)
+Version:      $(show_version)
 GitHub:       https://github.com/apache/incubator-streampipes-installer
 
 Usage: $cli_name COMMAND [OPTIONS]
 
 Options:
-  --help, -h  show help
+  --help, -h      show help
+  --version, -v   show version
 
 Commands:
   clean       Clean all configs/docker data volumes from system
@@ -78,7 +79,10 @@ case "$1" in
   template)
     "$STREAMPIPES_WORKDIR/bin/commands/template" "${@:2}"
     ;;
-  *)
+  -v|--version)
+    show_version
+    ;;
+  -h|--help|*)
     cli_help
     ;;
 esac