mirror of
https://github.com/apple/swift-argument-parser.git
synced 2026-06-06 20:18:23 +00:00
- Removes one layer of help properties by directly including the members of ArgumentHelp in ArgumentDefinition.Help. This also results in the discussion field which previously existed in both structures, now having a single source of truth. Adds helper method for setting each of these members using an instance of ArgumentHelp. Makes previously optional Strings into plain Strings and updates points of use to check for the empty string case.
17 lines
562 B
Swift
17 lines
562 B
Swift
//===----------------------------------------------------------*- swift -*-===//
|
|
//
|
|
// This source file is part of the Swift Argument Parser open source project
|
|
//
|
|
// Copyright (c) 2021 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
extension Collection {
|
|
func mapEmpty(_ replacement: () -> Self) -> Self {
|
|
isEmpty ? replacement() : self
|
|
}
|
|
}
|