Browse Source

[Feature] Add version display in cli

monf 8 years ago
parent
commit
43c7381568
2 changed files with 16 additions and 0 deletions
  1. 13 0
      Docs/kalliope_cli.md
  2. 3 0
      kalliope/__init__.py

+ 13 - 0
Docs/kalliope_cli.md

@@ -49,6 +49,18 @@ kalliope install --git-url https://github.com/kalliope-project/kalliope_neuron_w
 
 Commands can be completed by the following options:
 
+### -v or --version
+Display the current isntalled version of Kalliope.
+
+Example of use
+```
+kalliope --version
+```
+
+```
+kalliope -v
+```
+
 ### --run-synapse SYNAPSE_NAME
 
 Run a specific synapse from the brain file.
@@ -85,3 +97,4 @@ kalliope start --debug
 ### --git-url
 
 Used by the `install` argument to specify the URL of a git repository of the module to install.
+

+ 3 - 0
kalliope/__init__.py

@@ -8,6 +8,8 @@ from kalliope.core import Utils
 from kalliope.core.ConfigurationManager.BrainLoader import BrainLoader
 from kalliope.core.EventManager import EventManager
 from kalliope.core.MainController import MainController
+
+from _version import version_str
 import signal
 import sys
 
@@ -43,6 +45,7 @@ def main():
     parser.add_argument("--brain-file", help="Full path of a brain file")
     parser.add_argument("--debug", action='store_true', help="Show debug output")
     parser.add_argument("--git-url", help="Git URL of the neuron to install")
+    parser.add_argument('-v', '--version', action='version', version='Kalliope ' + version_str)
 
     # parse arguments from script parameters
     args = parser.parse_args()