Add --version option

Change-Id: I4390f2df5a7e0c61c6f8a5233e5092f9f907435e
diff --git a/src/index.js b/src/index.js
index f8e16f9..348a9a7 100755
--- a/src/index.js
+++ b/src/index.js
@@ -1,5 +1,7 @@
 #!/usr/bin/env node
 
+const packageVersion = require('../package.json').version;
+
 const emoticonRegex = /^(\:\w+\:|\<[\/\\]?3|[\(\)\\\D|\*\$][\-\^]?[\:\;\=]|[\:\;\=B8][\-\^]?[3DOPp\@\$\*\\\)\(\/\|])(?=\s|[\!\.\?]|$)/;
 const hashtagRegex = /^#(?=.*\p{L})[\p{L}\p{M}\p{N}]+$/u;
 const urlRegex = /^(ftp|http)s?:\/\/[^\s]+/;
@@ -33,6 +35,7 @@
 
 const optionDefinitions = [
   { name: 'sparse', alias: 's', type: Boolean, description: 'Print only the files, lines that have POS annotations.' },
+  { name: 'version', alias: 'V', type: Boolean, description: 'Print the current package version.' },
   { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide.' },
 ]
 
@@ -43,7 +46,7 @@
   },
   {
     header: 'Synopsis',
-    content: '$ conllu-cmc [-s] < input.conllu > output.conllu'
+    content: '$ conllu-cmc [-s] < input.conllu > output.conllu\n$ conllu-cmc -V'
   },
   {
     header: 'Options',
@@ -68,6 +71,11 @@
   process.exit(0);
 }
 
+if (options.version) {
+  console.log(packageVersion);
+  process.exit(0);
+}
+
 const EmojiRegex = require('emoji-regex');
 const emojiRegex = EmojiRegex();
 const { once } = require('events');