apple / apple/swift-argument-parser

Document how to provide memberwise initializers for Parsable* types

Open
#124 1 comment 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Swift
Stars
3.8k
Forks
411
Avg merge
7d 14h
Merged PRs (30d)
15

Description

As pointed out in #120, there isn't any documentation describing how to manually create instances of `ParsableArguments` or `ParsableCommand` types, and the error message when using one created from calling the default init (e.g. `let command = MyCommand()`) indicates that the only way to create one is through parsing.

Instead, the [Manual Parsing and Testing](https://github.com/apple/swift-argument-parser/blob/master/Documentation/06%20Manual%20Parsing%20and%20Testing.md) guide should cover adding a memberwise init as a way to create testable instances of the type, and the error should be updated to indicate that possibility.

Contributor guide

Open the contributing guide

Research direction

Start with Documentation/06 Manual Parsing and Testing.md and review the existing guidance for manually creating ParsableArguments or ParsableCommand instances. Then locate the error produced after calling a type's default init, update the documentation and wording to cover memberwise initializers, and verify the examples and error behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
63/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.