def enforce_dependencies(cache): # Vim version is already checked in vimscript file # This is done so that we avoid problems with +python TASKLIB_VERSION = '2.2.1' TASKWARRIOR_VERSION = '2.4.0' # Check tasklib version tasklib_module_version = getattr(tasklib, '__version__', '2.2.0') tasklib_installed_version = LooseVersion(tasklib_module_version) tasklib_required_version = LooseVersion(TASKLIB_VERSION) if tasklib_required_version > tasklib_installed_version: raise TaskWikiException("Tasklib version at least %s is required." % TASKLIB_VERSION) # Check taskwarrior version tw = cache.warriors['default'] taskwarrior_installed_version = LooseVersion(tw.version) taskwarrior_required_version = LooseVersion(TASKWARRIOR_VERSION) if taskwarrior_required_version > taskwarrior_installed_version: raise TaskWikiException( "Taskwarrior version at least %s is required." % TASKWARRIOR_VERSION)
def get_input(prompt="Enter: ", allow_empty=False): value = vim.eval('input("%s")' % prompt) vim.command('redraw') # Check for empty value and bail out if not allowed if not value and not allow_empty: raise TaskWikiException("Input must be provided.") return value