From 5a7ca46be182c48a033c222a33976693ebd909ed Mon Sep 17 00:00:00 2001 From: Nate Cook Date: Mon, 26 Sep 2022 10:31:49 -0500 Subject: [PATCH] Make helper naming consistent --- Sources/ArgumentParser/Usage/DumpHelpGenerator.swift | 2 +- Sources/ArgumentParser/Utilities/StringExtensions.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift b/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift index 2f02b5e7f..27c301888 100644 --- a/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift +++ b/Sources/ArgumentParser/Usage/DumpHelpGenerator.swift @@ -126,7 +126,7 @@ fileprivate extension ArgumentInfoV0 { self.init( kind: kind, shouldDisplay: argument.help.visibility.base == .default, - sectionTitle: argument.help.parentTitle.nilIfEmpty, + sectionTitle: argument.help.parentTitle.nonEmpty, isOptional: argument.help.options.contains(.isOptional), isRepeating: argument.help.options.contains(.isRepeating), names: argument.names.map(ArgumentInfoV0.NameInfoV0.init), diff --git a/Sources/ArgumentParser/Utilities/StringExtensions.swift b/Sources/ArgumentParser/Utilities/StringExtensions.swift index b49abe8ba..dba3b3594 100644 --- a/Sources/ArgumentParser/Utilities/StringExtensions.swift +++ b/Sources/ArgumentParser/Utilities/StringExtensions.swift @@ -239,7 +239,7 @@ extension StringProtocol where SubSequence == Substring { return "\(lines[0])\n\(lines[1].indentingEachLine(by: n))" } - var nilIfEmpty: Self? { + fileprivate var nonEmpty: Self? { isEmpty ? nil : self } }