(self)
| 44 | self.arguments = arguments |
| 45 | |
| 46 | def __call__(self) -> None: |
| 47 | if self.arguments.get("report"): |
| 48 | out.write(f"Commitizen Version: {__version__}") |
| 49 | out.write(f"Python Version: {sys.version}") |
| 50 | out.write(f"Operating System: {platform.system()}") |
| 51 | return |
| 52 | |
| 53 | if self.arguments.get("verbose"): |
| 54 | out.write(f"Installed Commitizen Version: {__version__}") |
| 55 | |
| 56 | if self.arguments.get("commitizen"): |
| 57 | out.write(__version__) |
| 58 | return |
| 59 | |
| 60 | if ( |
| 61 | self.arguments.get("project") |
| 62 | or self.arguments.get("verbose") |
| 63 | or self.arguments.get("next") |
| 64 | or self.arguments.get("manual_version") |
| 65 | ): |
| 66 | version_str = self.arguments.get("manual_version") |
| 67 | if version_str is None: |
| 68 | try: |
| 69 | version_str = get_provider(self.config).get_version() |
| 70 | except NoVersionSpecifiedError: |
| 71 | out.error("No project information in this project.") |
| 72 | return |
| 73 | try: |
| 74 | scheme_factory = get_version_scheme(self.config.settings) |
| 75 | except VersionSchemeUnknown: |
| 76 | out.error("Unknown version scheme.") |
| 77 | return |
| 78 | |
| 79 | try: |
| 80 | version = scheme_factory(version_str) |
| 81 | except InvalidVersion: |
| 82 | out.error(f"Invalid version: '{version_str}'") |
| 83 | return |
| 84 | |
| 85 | if next_increment_str := self.arguments.get("next"): |
| 86 | if next_increment_str == "USE_GIT_COMMITS": |
| 87 | # TODO: implement USE_GIT_COMMITS by deriving the increment from |
| 88 | # git history. This requires refactoring the bump logic out of |
| 89 | # `commitizen/commands/bump.py` so it can be reused here. See #1678. |
| 90 | out.error("--next USE_GIT_COMMITS is not implemented yet.") |
| 91 | return |
| 92 | |
| 93 | next_increment = VersionIncrement.from_value(next_increment_str) |
| 94 | increment: Increment | None |
| 95 | if next_increment == VersionIncrement.NONE: |
| 96 | increment = None |
| 97 | elif next_increment == VersionIncrement.PATCH: |
| 98 | increment = "PATCH" |
| 99 | elif next_increment == VersionIncrement.MINOR: |
| 100 | increment = "MINOR" |
| 101 | else: |
| 102 | increment = "MAJOR" |
| 103 | version = version.bump(increment=increment) |
nothing calls this directly
no test coverage detected