Skip to content

Support ArgumentParser.fromfile_prefix_chars#91

Open
lehmannro wants to merge 4 commits intosphinx-doc:mainfrom
lehmannro:fromfile
Open

Support ArgumentParser.fromfile_prefix_chars#91
lehmannro wants to merge 4 commits intosphinx-doc:mainfrom
lehmannro:fromfile

Conversation

@lehmannro
Copy link
Copy Markdown
Member

ArgumentParser.fromfile_prefix_chars allows specifying a filename to read additional parameters from. For example, when fromfile_prefix_chars="@", calling <command> @file.txt will read file.txt for more parameters.

This change adds [@file] to the usage line (or whichever character was configured first.) If there is more than one prefix character configured, there's also a text paragraph added to document all of them.

`argparse.ArgumentParser(fromfile_prefix_chars)` allows specifying a filename
prefixed by any of the characters included in the string.
`fromfile_prefix_chars='@'` means `@file.txt` is interpreted not as a regular
positional argument, but as an instruction to read `file.txt` for additional
arguments (positional or named.)

For now, only the first character in the string is documented such that the
usage instructions don't get overloaded.
Add a separate paragraph *iff* `fromfile_prefix_chars` was more than one
character to enumerate all possible prefixes.
Linter fixes by `ruff`.
Linter fixes by `ruff format`.
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.65%. Comparing base (528aa98) to head (fb60a2d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #91      +/-   ##
==========================================
+ Coverage   50.19%   50.65%   +0.45%     
==========================================
  Files          18       18              
  Lines        1289     1301      +12     
  Branches      262      265       +3     
==========================================
+ Hits          647      659      +12     
  Misses        598      598              
  Partials       44       44              
Flag Coverage Δ
unittests 50.42% <100.00%> (+0.46%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant