apple / apple/swift-argument-parser

Add support for params files

Open
#41 15 comments 11 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
Swift
Stars
3.8k
Forks
411
Avg merge
7d 14h
Merged PRs (30d)
15

Description

Some tools/situations end up needing so many arguments that they can run in to the max command line length. This is usually handled via _argument files_ or _parameter files_ -- if an argument is prefixed with a marker (usually `@`), then the contents of the referenced file are read at that location in the command line as if the content were on the command line. This also usually works recursively in that the read file could include another one of these directives to read yet another file.

There can be two types of "modes" that are supported for reading these files:
- _multiline_ : Every line of the files is a single argument. This is the easy one, as it means spaces, etc. are part of the arg, there is no need to understand escaping, just split on newlines and handle things.
- _shell quoted_ : The files are parse like a Bourne shell would, this requires handing quotes and escapes. `swift` and `clang` support files in this form.

Reference:
- Python ArgParse support: https://docs.python.org/3/library/argparse.html#fromfile-prefix-chars
- Bazel docs with notes about generating files for these two modes: https://docs.bazel.build/versions/2.0.0/skylark/lib/Args.html#set_param_file_format

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or entry points. Start by locating the argument expansion and parsing logic, then clarify the design for multiline and shell-quoted parameter files, recursive expansion, and the marker syntax. Done means both formats and nested references are supported with documented behavior and tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.