From 2ff1bf4ef84b84513d941840829f3332576cba7b Mon Sep 17 00:00:00 2001 From: Richard Pappalardo Date: Tue, 31 May 2016 15:49:43 -0700 Subject: [PATCH] feat: add ff-tool --version flag (#89) * feat: add --version flag Closes #61 * style: flake8 fix --- fftool/arg_parser.py | 7 +++++++ fftool/main.py | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/fftool/arg_parser.py b/fftool/arg_parser.py index ab62729..0d1361d 100644 --- a/fftool/arg_parser.py +++ b/fftool/arg_parser.py @@ -74,4 +74,11 @@ def arg_parser(): directory" ) + parser.add_argument( + '-v', + '--version', + action='store_true', + help="Print ff-tool version, then quit." + ) + return parser.parse_args() diff --git a/fftool/main.py b/fftool/main.py index 96c7c7e..b4df22b 100755 --- a/fftool/main.py +++ b/fftool/main.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from outlawg import Outlawg -from fftool import PATH_PREFS_ROOT +from fftool import PATH_PREFS_ROOT, __version__ from arg_parser import arg_parser from firefox_download import download from firefox_profile import create_mozprofile, clean_profiles @@ -14,6 +14,10 @@ def main(): Log.header('FF-TOOL: download, install & launch Firefox!', 'XL', '=') options = arg_parser() + if options.version: + print('FF-TOOL VERSION: {0}'.format(__version__)) + return + if options.app and not PATH_PREFS_ROOT: Log.header("ERROR") print("Missing path to $PATH_PREFS_ROOT directory.")