Skip to content

Commit

Permalink
feat: -v 查看版本号
Browse files Browse the repository at this point in the history
  • Loading branch information
laorange committed Dec 13, 2022
1 parent 7df775e commit be785f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from setuptools import setup, find_packages

from pathlib import Path

from stoken import version

HERE = Path(__file__).parent
README = (HERE / "README.md").read_text(encoding="utf-8")

setup(
name="stoken",
version="0.2.1",
version=version,
keywords=["git", "data desensitization", "replace token"],
description="A code desensitization tool, which can substitute tokens (and other sensitive information) in your code.",
long_description=README,
Expand Down
3 changes: 3 additions & 0 deletions stoken/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from stoken.main import Stoken, VERSION, Config

version = VERSION
7 changes: 6 additions & 1 deletion stoken/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import click
import git

VERSION = "0.2.2"
README_URL = "https://github.com/laorange/stoken"
BASE_DIR = Path.cwd().resolve()
colorama.just_fix_windows_console()
Expand Down Expand Up @@ -144,7 +145,11 @@ def execute(self, path: Path = None):
@click.option("-s", "--variable-suffix", default="}}#", help="The suffix of variable placeholder. Default: }}#")
@click.option('--debug', is_flag=True, help="In debug mode, `stoken` won't modify files, only detect tokens.")
@click.option('--no-git', is_flag=True, help="By default, the program will detect if there is a git directory, and if so, it will ignore the files in .gitignore. Activate this option to detect all the files.")
def main(mode: str, encoding: str, variable_prefix: str, variable_suffix: str, debug: bool, no_git: bool):
@click.option("-v", "--version", is_flag=True, help="To get the current version of stoken.")
def main(mode: str, encoding: str, variable_prefix: str, variable_suffix: str, debug: bool, no_git: bool, version: bool):
if version:
return print(f"v{VERSION}")

stoken = Stoken(mode, encoding, variable_prefix, variable_suffix, debug, no_git)
stoken.execute()
stoken.quit_with_info(f"{Fore.GREEN}stoken: finished!{Fore.RESET}")
Expand Down

0 comments on commit be785f3

Please sign in to comment.