Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: add --version flag #147

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/fragments/147-version-option.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
minor_changes:
- "Add ``--version`` flag to print package version and exit
(https://github.com/ansible-community/antsibull-changelog/pull/147)."
2 changes: 2 additions & 0 deletions src/antsibull_changelog/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
except ImportError:
HAS_ARGCOMPLETE = False

from . import __version__ as _version
from .ansible import get_ansible_release
from .changes import ChangesBase, add_release, load_changes
from .config import ChangelogConfig, CollectionDetails, PathsConfig, TextFormat
Expand Down Expand Up @@ -113,6 +114,7 @@ def create_argparser(program_name: str) -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
prog=program_name, description="Changelog generator and linter."
)
parser.add_argument("--version", action="version", version=_version)

common = argparse.ArgumentParser(add_help=False)
common.add_argument(
Expand Down
Loading