mirror of
https://github.com/davegallant/rfd.git
synced 2025-08-07 00:58:14 +00:00
Bump click from 7.1.2 to 8.0.1 (#95)
* Bump click from 7.1.2 to 8.0.1 Bumps [click](https://github.com/pallets/click) from 7.1.2 to 8.0.1. - [Release notes](https://github.com/pallets/click/releases) - [Changelog](https://github.com/pallets/click/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/click/compare/7.1.2...8.0.1) Signed-off-by: dependabot[bot] <support@github.com> * Get version using importlib.metdata * Conditionally import metadata Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dave Gallant <dave.gallant@rewind.io>
This commit is contained in:
@@ -1 +0,0 @@
|
||||
0.7.1
|
@@ -1,12 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from os.path import dirname, abspath, join
|
||||
|
||||
|
||||
def load_version():
|
||||
with open(join(dirname(abspath(__file__)), "VERSION")) as handle:
|
||||
return handle.read()
|
||||
|
||||
|
||||
version = load_version()
|
12
rfd/cli.py
12
rfd/cli.py
@@ -4,11 +4,15 @@ from __future__ import unicode_literals
|
||||
import logging
|
||||
import sys
|
||||
import click
|
||||
try:
|
||||
from importlib import metadata
|
||||
except ImportError: # for Python<3.8
|
||||
import importlib_metadata as metadata
|
||||
from colorama import init
|
||||
from .api import get_threads, get_posts
|
||||
from .threads import parse_threads, search_threads, sort_threads, generate_thread_output
|
||||
from .posts import generate_posts_output
|
||||
from .__version__ import version as current_version
|
||||
|
||||
|
||||
init()
|
||||
|
||||
@@ -18,12 +22,12 @@ logging.getLogger().addHandler(logging.StreamHandler())
|
||||
|
||||
|
||||
def get_version():
|
||||
return "rfd v" + current_version
|
||||
return "rfd v" + metadata.version("rfd")
|
||||
|
||||
def print_version(ctx, value):
|
||||
def print_version(ctx, _, value):
|
||||
if not value or ctx.resilient_parsing:
|
||||
return
|
||||
click.echo(get_version(), nl=False)
|
||||
click.echo(get_version(), nl=True)
|
||||
ctx.exit()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user