Skip to content

Commit aa18cbd

Browse files
dickoffnatecook1000
authored andcommitted
Merge branch 'main' into user/dickoff/help-search-functionality
2 parents 850c1bd + 16cae93 commit aa18cbd

75 files changed

Lines changed: 3475 additions & 1011 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
groups:
8+
swiftlang-actions:
9+
patterns:
10+
- "swiftlang/github-workflows/*"

.github/workflows/pull_request.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout repo
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v6
1717

1818
- name: Install apt dependencies
1919
run: sudo apt-get -qq update && sudo apt-get -qq -y install curl
@@ -25,8 +25,10 @@ jobs:
2525
2626
tests:
2727
name: Test
28-
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
28+
needs: [soundness, validate_format_config]
29+
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.11
2930
with:
31+
linux_swift_versions: "[ \"6.0\", \"6.1\", \"6.2\", \"nightly-main\", \"nightly-6.3\"]"
3032
windows_exclude_swift_versions: "[{\"swift_version\": \"5.9\"}]"
3133
enable_macos_checks: true
3234
macos_exclude_xcode_versions: "[{\"xcode_version\": \"16.0\"}, {\"xcode_version\": \"16.1\"}, {\"xcode_version\": \"16.2\"}]"
@@ -35,12 +37,13 @@ jobs:
3537

3638
cmake-build:
3739
name: CMake Build
40+
needs: [soundness, validate_format_config]
3841
runs-on: ubuntu-latest
3942
container:
4043
image: swift:6.0-jammy
4144
steps:
4245
- name: Checkout repo
43-
uses: actions/checkout@v4
46+
uses: actions/checkout@v6
4447
- name: Install apt dependencies
4548
run: apt-get -qq update && apt-get -qq -y install curl ninja-build
4649
- name: Install CMake 3.30.2
@@ -58,6 +61,14 @@ jobs:
5861

5962
soundness:
6063
name: Soundness
61-
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
64+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.11
6265
with:
6366
shell_check_enabled: false # bug: https://github.com/apple/swift-argument-parser/issues/703
67+
68+
required:
69+
name: Required
70+
runs-on: ubuntu-latest
71+
needs: [tests, soundness, validate_format_config, cmake-build]
72+
steps:
73+
- name: Success
74+
run: echo "All required jobs succeeded."

CHANGELOG.md

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,51 @@ Add new items at the end of the relevant section under **Unreleased**.
88

99
---
1010

11+
## [1.7.1] - 2026-03-20
12+
13+
### Changes
14+
15+
- Adds detailed documentation for providing descriptions of enum values. ([#825])
16+
- Adds `aliases` to the dump-help output. ([#813])
17+
- Improves zsh completions; prevents bash completion cleanup commands from being appended to shell history. ([#864], [#859])
18+
- Eliminates deprecation warnings in `Examples/math`. ([#879])
19+
20+
### Fixes
21+
22+
- Fixes build issues in Swift 5.7-5.9. ([#874], [#875])
23+
- Fixes `--help` output for nested subcommands with default subcommands. ([#866])
24+
- Prevents `@OptionGroup` type names from appearing in help usage strings. ([#873])
25+
- Fixes handling of visibility with nested option groups. ([#838])
26+
- Updates GitHub Actions workflows and streamlines the required checks. ([#839], [#843], [#844], [#853], [#856], [#857], [#876], [#877])
27+
28+
The 1.7.0 release includes contributions from [bkhouri], [bob-wilson], [jglogan],
29+
[kphrx], [louisunlimited], [natecook1000], [rauhul], [rgoldberg], [salmanmkc],
30+
[stackotter], and [William-Laverty]. Thank you!
31+
32+
## [1.7.0] - 2025-12-17
33+
34+
### Additions
35+
36+
- Access the state of an ancestor command using the new `@ParentCommand` property wrapper. ([#802])
37+
38+
### Fixes
39+
40+
- Corrects the help display for an case iterable option value type. ([#821])
41+
- Fixes ArgumentParser build failure for WASI (WebAssembly System Interface). ([#794])
42+
- Updates help text for readability in Repeat example and README. ([#787])
43+
- Provides an ambiguity breaker for some `ExpressibleByArgument` types. ([#841])
44+
- Shell completion script fixes. ([#801], [#808], [#811])
45+
46+
### Changes
47+
48+
- `docc`: Updates the output to present the string representation of command arguments as a wrapped text block. ([#791])
49+
- Uses Foundation Essentials when possible to reduce binary size on non-Darwin platforms. ([#804])
50+
- CMake: Suppress needlessly alarming messages. ([#628])
51+
52+
The 1.7.0 release includes contributions from [bkhouri], [cmcgee1024], [dabrahams], [heckj], [incertum], [kkebo], [Konstantin-Krokhin], [natecook1000], [rauhul], [rgoldberg], and [tshortli]. Thank you!
53+
54+
---
55+
1156
## [1.6.2] - 2025-10-01
1257

1358
### Fixes
@@ -966,7 +1011,9 @@ This changelog's format is based on [Keep a Changelog](https://keepachangelog.co
9661011

9671012
<!-- Link references for releases -->
9681013

969-
[Unreleased]: https://github.com/apple/swift-argument-parser/compare/1.6.2...HEAD
1014+
[Unreleased]: https://github.com/apple/swift-argument-parser/compare/1.7.1...HEAD
1015+
[1.7.1]: https://github.com/apple/swift-argument-parser/compare/1.7.0...1.7.1
1016+
[1.7.0]: https://github.com/apple/swift-argument-parser/compare/1.6.2...1.7.0
9701017
[1.6.2]: https://github.com/apple/swift-argument-parser/compare/1.6.1...1.6.2
9711018
[1.6.1]: https://github.com/apple/swift-argument-parser/compare/1.6.0...1.6.1
9721019
[1.6.0]: https://github.com/apple/swift-argument-parser/compare/1.5.1...1.6.0
@@ -1093,6 +1140,7 @@ This changelog's format is based on [Keep a Changelog](https://keepachangelog.co
10931140
[#619]: https://github.com/apple/swift-argument-parser/pull/619
10941141
[#621]: https://github.com/apple/swift-argument-parser/pull/621
10951142
[#627]: https://github.com/apple/swift-argument-parser/pull/627
1143+
[#628]: https://github.com/apple/swift-argument-parser/pull/628
10961144
[#634]: https://github.com/apple/swift-argument-parser/pull/634
10971145
[#636]: https://github.com/apple/swift-argument-parser/pull/636
10981146
[#644]: https://github.com/apple/swift-argument-parser/pull/644
@@ -1158,9 +1206,36 @@ This changelog's format is based on [Keep a Changelog](https://keepachangelog.co
11581206
[#777]: https://github.com/apple/swift-argument-parser/pull/777
11591207
[#782]: https://github.com/apple/swift-argument-parser/pull/782
11601208
[#783]: https://github.com/apple/swift-argument-parser/pull/783
1209+
[#787]: https://github.com/apple/swift-argument-parser/pull/787
11611210
[#789]: https://github.com/apple/swift-argument-parser/pull/789
1211+
[#791]: https://github.com/apple/swift-argument-parser/pull/791
11621212
[#792]: https://github.com/apple/swift-argument-parser/pull/792
11631213
[#794]: https://github.com/apple/swift-argument-parser/pull/794
1214+
[#801]: https://github.com/apple/swift-argument-parser/pull/801
1215+
[#802]: https://github.com/apple/swift-argument-parser/pull/802
1216+
[#804]: https://github.com/apple/swift-argument-parser/pull/804
1217+
[#808]: https://github.com/apple/swift-argument-parser/pull/808
1218+
[#811]: https://github.com/apple/swift-argument-parser/pull/811
1219+
[#813]: https://github.com/apple/swift-argument-parser/pull/813
1220+
[#821]: https://github.com/apple/swift-argument-parser/pull/821
1221+
[#825]: https://github.com/apple/swift-argument-parser/pull/825
1222+
[#838]: https://github.com/apple/swift-argument-parser/pull/838
1223+
[#839]: https://github.com/apple/swift-argument-parser/pull/839
1224+
[#841]: https://github.com/apple/swift-argument-parser/pull/841
1225+
[#843]: https://github.com/apple/swift-argument-parser/pull/843
1226+
[#844]: https://github.com/apple/swift-argument-parser/pull/844
1227+
[#853]: https://github.com/apple/swift-argument-parser/pull/853
1228+
[#856]: https://github.com/apple/swift-argument-parser/pull/856
1229+
[#857]: https://github.com/apple/swift-argument-parser/pull/857
1230+
[#859]: https://github.com/apple/swift-argument-parser/pull/859
1231+
[#864]: https://github.com/apple/swift-argument-parser/pull/864
1232+
[#866]: https://github.com/apple/swift-argument-parser/pull/866
1233+
[#873]: https://github.com/apple/swift-argument-parser/pull/873
1234+
[#874]: https://github.com/apple/swift-argument-parser/pull/874
1235+
[#875]: https://github.com/apple/swift-argument-parser/pull/875
1236+
[#876]: https://github.com/apple/swift-argument-parser/pull/876
1237+
[#877]: https://github.com/apple/swift-argument-parser/pull/877
1238+
[#879]: https://github.com/apple/swift-argument-parser/pull/879
11641239

11651240
<!-- Link references for contributors -->
11661241

@@ -1173,18 +1248,22 @@ This changelog's format is based on [Keep a Changelog](https://keepachangelog.co
11731248
[artemnovichkov]: https://github.com/apple/swift-argument-parser/commits?author=artemnovichkov
11741249
[atierian]: https://github.com/apple/swift-argument-parser/commits?author=atierian
11751250
[Austinpayne]: https://github.com/apple/swift-argument-parser/commits?author=Austinpayne
1251+
[bkhouri]: https://github.com/apple/swift-argument-parser/commits?author=bkhouri
1252+
[bob-wilson]: https://github.com/apple/swift-argument-parser/commits?author=bob-wilson
11761253
[BradLarson]: https://github.com/apple/swift-argument-parser/commits?author=BradLarson
11771254
[bripeticca]: https://github.com/apple/swift-argument-parser/commits?author=bripeticca
11781255
[buttaface]: https://github.com/apple/swift-argument-parser/commits?author=buttaface
11791256
[cg-soft]: https://github.com/apple/swift-argument-parser/commits?author=cg-soft
11801257
[Chamepp]: https://github.com/apple/swift-argument-parser/commits?author=Chamepp
11811258
[clayellis]: https://github.com/apple/swift-argument-parser/commits?author=clayellis
1259+
[cmcgee1024]: https://github.com/apple/swift-argument-parser/commits?author=cmcgee1024
11821260
[CodaFi]: https://github.com/apple/swift-argument-parser/commits?author=CodaFi
11831261
[Coeur]: https://github.com/apple/swift-argument-parser/commits?author=Coeur
11841262
[compnerd]: https://github.com/apple/swift-argument-parser/commits?author=compnerd
11851263
[CraigSiemens]: https://github.com/apple/swift-argument-parser/commits?author=CraigSiemens
11861264
[CypherPoet]: https://github.com/apple/swift-argument-parser/commits?author=CypherPoet
11871265
[d-ronnqvist]: https://github.com/apple/swift-argument-parser/commits?author=d-ronnqvist
1266+
[dabrahams]: https://github.com/apple/swift-argument-parser/commits?author=dabrahams
11881267
[damuellen]: https://github.com/apple/swift-argument-parser/commits?author=damuellen
11891268
[dcantah]: https://github.com/apple/swift-argument-parser/commits?author=dcantah
11901269
[dduan]: https://github.com/apple/swift-argument-parser/commits?author=dduan
@@ -1207,9 +1286,11 @@ This changelog's format is based on [Keep a Changelog](https://keepachangelog.co
12071286
[ian-twilightcoder]: https://github.com/apple/swift-argument-parser/commits?author=ian-twilightcoder
12081287
[ibrahimoktay]: https://github.com/apple/swift-argument-parser/commits?author=ibrahimoktay
12091288
[imxieyi]: https://github.com/apple/swift-argument-parser/commits?author=imxieyi
1289+
[incertum]: https://github.com/apple/swift-argument-parser/commits?author=incertum
12101290
[IngmarStein]: https://github.com/apple/swift-argument-parser/commits?author=IngmarStein
12111291
[interstateone]: https://github.com/apple/swift-argument-parser/commits?author=interstateone
12121292
[jakepetroules]: https://github.com/apple/swift-argument-parser/commits?author=jakepetroules
1293+
[jglogan]: https://github.com/apple/swift-argument-parser/commits?author=jglogan
12131294
[john-mueller]: https://github.com/apple/swift-argument-parser/commits?author=john-mueller
12141295
[jonathanpenn]: https://github.com/apple/swift-argument-parser/commits?author=jonathanpenn
12151296
[keith]: https://github.com/apple/swift-argument-parser/commits?author=keith
@@ -1219,10 +1300,13 @@ This changelog's format is based on [Keep a Changelog](https://keepachangelog.co
12191300
[kkk669]: https://github.com/apple/swift-argument-parser/commits?author=kkk669
12201301
[klaaspieter]: https://github.com/apple/swift-argument-parser/commits?author=klaaspieter
12211302
[konomae]: https://github.com/apple/swift-argument-parser/commits?author=konomae
1303+
[Konstantin-Krokhin]: https://github.com/apple/swift-argument-parser/commits?author=Konstantin-Krokhin
1304+
[kphrx]: https://github.com/apple/swift-argument-parser/commits?author=kphrx
12221305
[KS1019]: https://github.com/apple/swift-argument-parser/commits?author=KS1019
12231306
[kylemacomber]: https://github.com/apple/swift-argument-parser/commits?author=kylemacomber
12241307
[Lantua]: https://github.com/apple/swift-argument-parser/commits?author=Lantua
12251308
[lorentey]: https://github.com/apple/swift-argument-parser/commits?author=lorentey
1309+
[louisunlimited]: https://github.com/apple/swift-argument-parser/commits?author=louisunlimited
12261310
[LucianoPAlmeida]: https://github.com/apple/swift-argument-parser/commits?author=LucianoPAlmeida
12271311
[MarcoEidinger]: https://github.com/apple/swift-argument-parser/commits?author=MarcoEidinger
12281312
[MartinP7r]: https://github.com/apple/swift-argument-parser/commits?author=MartinP7r
@@ -1246,20 +1330,24 @@ This changelog's format is based on [Keep a Changelog](https://keepachangelog.co
12461330
[rjstelling]: https://github.com/apple/swift-argument-parser/commits?author=rjstelling
12471331
[robertmryan]: https://github.com/apple/swift-argument-parser/commits?author=robertmryan
12481332
[Sajjon]: https://github.com/apple/swift-argument-parser/commits?author=Sajjon
1333+
[salmanmkc]: https://github.com/apple/swift-argument-parser/commits?author=salmanmkc
12491334
[schlagelk]: https://github.com/apple/swift-argument-parser/commits?author=schlagelk
12501335
[SergeyPetrachkov]: https://github.com/apple/swift-argument-parser/commits?author=SergeyPetrachkov
12511336
[sgl0v]: https://github.com/apple/swift-argument-parser/commits?author=sgl0v
12521337
[sharplet]: https://github.com/apple/swift-argument-parser/commits?author=sharplet
12531338
[sjavora]: https://github.com/apple/swift-argument-parser/commits?author=sjavora
1339+
[stackotter]: https://github.com/apple/swift-argument-parser/commits?author=stackotter
12541340
[Steelskin]: https://github.com/apple/swift-argument-parser/commits?author=Steelskin
12551341
[stuartcarnie]: https://github.com/apple/swift-argument-parser/commits?author=stuartcarnie
12561342
[thomasvl]: https://github.com/apple/swift-argument-parser/commits?author=thomasvl
12571343
[TiagoMaiaL]: https://github.com/apple/swift-argument-parser/commits?author=TiagoMaiaL
12581344
[toddthomas]: https://github.com/apple/swift-argument-parser/commits?author=toddthomas
1345+
[tshortli]: https://github.com/apple/swift-argument-parser/commits?author=tshortli
12591346
[vlm]: https://github.com/apple/swift-argument-parser/commits?author=vlm
12601347
[werm098]: https://github.com/apple/swift-argument-parser/commits?author=werm098
12611348
[Wevah]: https://github.com/apple/swift-argument-parser/commits?author=Wevah
12621349
[Wildchild9]: https://github.com/apple/swift-argument-parser/commits?author=Wildchild9
1350+
[William-Laverty]: https://github.com/apple/swift-argument-parser/commits?author=William-Laverty
12631351
[yim-lee]: https://github.com/apple/swift-argument-parser/commits?author=yim-lee
12641352
[yonihemi]: https://github.com/apple/swift-argument-parser/commits?author=yonihemi
12651353
[YuAo]: https://github.com/apple/swift-argument-parser/commits?author=YuAo
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift Argument Parser open source project
4+
//
5+
// Copyright (c) 2025 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
//
10+
//===----------------------------------------------------------------------===//
11+
12+
import ArgumentParser
13+
14+
@main
15+
struct DefaultAsFlag: ParsableCommand {
16+
static let configuration = CommandConfiguration(
17+
abstract: "A utility demonstrating defaultAsFlag options.",
18+
discussion: """
19+
This command shows how defaultAsFlag options can work both as flags
20+
and as options with values.
21+
"""
22+
)
23+
24+
@Option(defaultAsFlag: "default", help: "A string option with defaultAsFlag.")
25+
var stringFlag: String?
26+
27+
@Option(defaultAsFlag: 42, help: "An integer option with defaultAsFlag.")
28+
var numberFlag: Int?
29+
30+
@Option(defaultAsFlag: true, help: "A boolean option with defaultAsFlag.")
31+
var boolFlag: Bool?
32+
33+
@Option(
34+
defaultAsFlag: "transformed",
35+
help: "A string option with transform and defaultAsFlag.",
36+
transform: { $0.uppercased() }
37+
)
38+
var transformFlag: String?
39+
40+
@Option(name: .shortAndLong, help: "A regular option for comparison.")
41+
var regular: String?
42+
43+
@Argument
44+
var additionalArgs: [String] = []
45+
46+
func run() {
47+
print("String flag: \(stringFlag?.description ?? "nil")")
48+
print("Number flag: \(numberFlag?.description ?? "nil")")
49+
print("Bool flag: \(boolFlag?.description ?? "nil")")
50+
print("Transform flag: \(transformFlag?.description ?? "nil")")
51+
print("Regular option: \(regular?.description ?? "nil")")
52+
print("Additional args: \(additionalArgs)")
53+
}
54+
}

Examples/math/Math.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ extension Math.Statistics {
204204
)
205205
var customArg: String?
206206

207+
@available(
208+
*, deprecated,
209+
message: "Deprecated use of custom completion for @Argument"
210+
)
207211
@Argument(
208212
completion: .custom { _ in ["alabaster", "breakfast", "crunch", "crash"] }
209213
)
@@ -236,6 +240,9 @@ extension Math.Statistics {
236240
@Option(completion: .custom(customCompletion))
237241
var custom: String?
238242

243+
@available(
244+
*, deprecated, message: "Deprecated use of custom completion for @Option"
245+
)
239246
@Option(completion: .custom(customDeprecatedCompletion))
240247
var customDeprecated: String?
241248

Package.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.7
1+
// swift-tools-version:6.0
22
//===----------------------------------------------------------------------===//
33
//
44
// This source file is part of the Swift Argument Parser open source project
@@ -78,6 +78,11 @@ var package = Package(
7878
name: "color",
7979
dependencies: ["ArgumentParser"],
8080
path: "Examples/color"),
81+
.executableTarget(
82+
name: "default-as-flag",
83+
dependencies: ["ArgumentParser"],
84+
path: "Examples/default-as-flag"
85+
),
8186

8287
// Tools
8388
.executableTarget(

0 commit comments

Comments
 (0)