diff --git a/.gitignore b/.gitignore index 2e17516..12ee45f 100644 --- a/.gitignore +++ b/.gitignore @@ -135,4 +135,5 @@ dmypy.json .pyre/ .activate.sh .DS_Store -.MyAppTest/ \ No newline at end of file +.MyAppTest + diff --git a/README.md b/README.md index cafc168..9537b00 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ To run all linters and tests, simply go to the root directory and run `tox` To upload your project to pypi simply run `. ./upload_package.sh` # Versions - + * `1.2.1` - Adds retries to get correct parameters and auto corrects parameters instead of exiting. * `1.2.0` - Refresh with new modern practices like an installation script. * `1.1.1` - Adds chmod +x to shell scripts and adds post install instructions. * `1.1.0` - createpythonapp -> createpythoncmd. diff --git a/pyproject.toml b/pyproject.toml index 956849b..a1e1370 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,8 @@ classifiers = ["Programming Language :: Python :: 3"] dependencies = [] # Change this with the version number bump. # Also make the change in zcmds/version.py -version = "1.2.0" +version = "1.2.1" [project.scripts] createpythoncmd = "create_python_cmd.cli:main" +create-python-cmd = "create_python_cmd.cli:main" diff --git a/src/create_python_cmd/createapp.py b/src/create_python_cmd/createapp.py index bb65e82..3dd6311 100644 --- a/src/create_python_cmd/createapp.py +++ b/src/create_python_cmd/createapp.py @@ -154,21 +154,41 @@ def create_python_app() -> None: # check if git exists if not shutil.which("git"): raise RuntimeError("Git is not installed.") - app_name = input("Python app name: ") - check_name(app_name) + while True: + try: + app_name = input("Python app name: ").replace("-", "_") + check_name(app_name) + break + except ValueError as e: + print(f"Error: {e}, try again") + continue + app_description = input("Python app description: ") app_keywords = input("Python app keywords: ") app_author = input("Python app author: ") github_url = input("GitHub URL: ") - version = input("Version [1.0.0]: ") - if not version: - version = "1.0.0" - check_semantic_version(version) + while True: + try: + version = input("Version [1.0.0]: ") + if not version: + version = "1.0.0" + check_semantic_version(version) + break + except ValueError as e: + print(f"Error: {e}, try again") + continue add_command = input("Add a command? [y/N]: ").lower() == "y" command_name = None if add_command: - command_name = input("Command name: ") - check_name(command_name) + while True: + try: + command_name = input("Command name: ") + command_name = command_name.replace("-", "_") + check_name(command_name) + break + except ValueError as e: + print(f"Error: {e}, try again") + continue do_create_python_app( app_description=app_description, app_author=app_author, @@ -177,10 +197,7 @@ def create_python_app() -> None: github_url=github_url, command_name=command_name, ) - print( - "\nDone! Now execute the following commands in git-bash:\n" - f" .install\n" - ) + print("\nDone! Now execute the following commands in git-bash:\n" f" ./install\n") print("If you are currently in VSCode then close the Program and reopen it.") print( "If running from the command line, make sure you enter into the virtual"