learn -V CLI option

Help users to get the versions while reporting bugs.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-06-07 00:36:57 +02:00
parent 19ac578a50
commit a41fecd057
2 changed files with 16 additions and 5 deletions

View File

@ -2,7 +2,7 @@
### General informations
- OfflineIMAP version:
- OfflineIMAP version (including imaplib2 if available: `offlineimap -V`):
- server name or domain:
- CLI options:

View File

@ -79,10 +79,11 @@ class OfflineImap(object):
return self.__sync(options)
def __parse_cmd_options(self):
parser = OptionParser(version=offlineimap.__version__,
description="%s.\n\n%s" %
(offlineimap.__copyright__,
offlineimap.__license__))
parser = OptionParser(
version=offlineimap.__version__,
description="%s.\n\n%s"% (offlineimap.__copyright__,
offlineimap.__license__)
)
parser.add_option("--dry-run",
action="store_true", dest="dryrun",
default=False,
@ -149,9 +150,19 @@ class OfflineImap(object):
action="store_true", dest="migrate_fmd5", default=False,
help="migrate FMD5 hashes from versions prior to 6.3.5")
parser.add_option("-V",
action="store_true", dest="version",
default=False,
help="show full version infos")
(options, args) = parser.parse_args()
globals.set_options (options)
if options.version:
print("offlineimap v%s, imaplib2 v%s (%s)"% (
offlineimap.__version__, imaplib.__version__, imaplib.DESC))
sys.exit(0)
# Read in configuration file.
if not options.configfile:
# Try XDG location, then fall back to ~/.offlineimaprc