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

Allow for extra arguments to hatchling build #1743

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 12 additions & 1 deletion backend/src/hatchling/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@ def hatchling() -> int:
metadata_command(subparsers, defaults)
version_command(subparsers, defaults)

kwargs = vars(parser.parse_args())
# Parse known arguments
kwargs, extras = parser.parse_known_args()

# Extras can exist to be detected in custom hooks and plugins,
# but they must be after a '--' separator
if extras and extras[0] != "--":
parser.print_help()
return 1

# Wrap the parsed arguments in a dictionary
kwargs = vars(kwargs)

try:
command = kwargs.pop('func')
except KeyError:
Expand Down