diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1be2bcecc..29c5ac34b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,8 @@
* Update Yams to 3.0.0.
[Keith Smiley](https://github.com/keith)
+* Extract all supported delimiters from document XML.
+ [Eneko Alonso](https://github.com/eneko)
* Add `SwiftDeclarationAttributeKind` values introduced in Swift 5.2.
[JP Simard](https://github.com/jpsim)
diff --git a/Source/SourceKittenFramework/File.swift b/Source/SourceKittenFramework/File.swift
index 0d6525679..758763ff4 100644
--- a/Source/SourceKittenFramework/File.swift
+++ b/Source/SourceKittenFramework/File.swift
@@ -459,6 +459,10 @@ public func parseFullXMLDocs(_ xmlDocs: String) -> [String: SourceKitRepresentab
.replacingOccurrences(of: "", with: "")
.replacingOccurrences(of: "", with: "`")
.replacingOccurrences(of: "", with: "`")
+ .replacingOccurrences(of: "", with: "_")
+ .replacingOccurrences(of: "", with: "_")
+// .replacingOccurrences(of: "", with: "**")
+// .replacingOccurrences(of: "", with: "**")
return SWXMLHash.parse(cleanXMLDocs).children.first.map { rootXML in
var docs = [String: SourceKitRepresentable]()
docs[SwiftDocKey.docType.rawValue] = rootXML.element?.name
@@ -484,12 +488,40 @@ public func parseFullXMLDocs(_ xmlDocs: String) -> [String: SourceKitRepresentab
}
docs[SwiftDocKey.docParameters.rawValue] = parameters.map(docParameters(from:)) as [SourceKitRepresentable]
}
+ docs[SwiftDocKey.docAbstract.rawValue] = commentPartsXML["Abstract"].childrenAsArray()
docs[SwiftDocKey.docDiscussion.rawValue] = commentPartsXML["Discussion"].childrenAsArray()
docs[SwiftDocKey.docResultDiscussion.rawValue] = commentPartsXML["ResultDiscussion"].childrenAsArray()
+ docs[SwiftDocKey.docThrowsDiscussion.rawValue] = commentPartsXML["ThrowsDiscussion"].childrenAsArray()
+ populateDelimiters(docs: &docs, discussion: commentPartsXML["Discussion"])
return docs
}
}
+/// Delimiters extracted from discussion (supported by Xcode)
+/// - see: https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_markup_formatting_ref/MarkupFunctionality.html
+func populateDelimiters(docs: inout [String: SourceKitRepresentable], discussion: XMLIndexer) {
+ docs[SwiftDocKey.docAttention.rawValue] = discussion["Attention"].childrenAsArray()
+ docs[SwiftDocKey.docAuthor.rawValue] = discussion["Author"].childrenAsArray()
+ docs[SwiftDocKey.docAuthors.rawValue] = discussion["Authors"].childrenAsArray()
+ docs[SwiftDocKey.docBug.rawValue] = discussion["Bug"].childrenAsArray()
+ docs[SwiftDocKey.docComplexity.rawValue] = discussion["Complexity"].childrenAsArray()
+ docs[SwiftDocKey.docCopyright.rawValue] = discussion["Copyright"].childrenAsArray()
+ docs[SwiftDocKey.docDate.rawValue] = discussion["Date"].childrenAsArray()
+ docs[SwiftDocKey.docExperiment.rawValue] = discussion["Experiment"].childrenAsArray()
+ docs[SwiftDocKey.docImportant.rawValue] = discussion["Important"].childrenAsArray()
+ docs[SwiftDocKey.docInvariant.rawValue] = discussion["Invariant"].childrenAsArray()
+ docs[SwiftDocKey.docNote.rawValue] = discussion["Note"].childrenAsArray()
+ docs[SwiftDocKey.docPostcondition.rawValue] = discussion["Postcondition"].childrenAsArray()
+ docs[SwiftDocKey.docPrecondition.rawValue] = discussion["Precondition"].childrenAsArray()
+ docs[SwiftDocKey.docRemark.rawValue] = discussion["Remark"].childrenAsArray()
+ docs[SwiftDocKey.docRequires.rawValue] = discussion["Requires"].childrenAsArray()
+ docs[SwiftDocKey.docSeeAlso.rawValue] = discussion["See"].childrenAsArray()
+ docs[SwiftDocKey.docSince.rawValue] = discussion["Since"].childrenAsArray()
+ docs[SwiftDocKey.docToDo.rawValue] = discussion["TODO"].childrenAsArray()
+ docs[SwiftDocKey.docVersion.rawValue] = discussion["Version"].childrenAsArray()
+ docs[SwiftDocKey.docWarning.rawValue] = discussion["Warning"].childrenAsArray()
+}
+
private extension XMLIndexer {
/**
Returns an `[SourceKitRepresentable]` of `[String: SourceKitRepresentable]` items from `indexer` children, if any.
diff --git a/Source/SourceKittenFramework/SwiftDocKey.swift b/Source/SourceKittenFramework/SwiftDocKey.swift
index 1e9e8c54f..40ca09f58 100644
--- a/Source/SourceKittenFramework/SwiftDocKey.swift
+++ b/Source/SourceKittenFramework/SwiftDocKey.swift
@@ -53,6 +53,8 @@ public enum SwiftDocKey: String {
case documentationComment = "key.doc.comment"
/// Declaration of documented token (String).
case docDeclaration = "key.doc.declaration"
+ /// Abstract of documented token
+ case docAbstract = "key.doc.abstract"
/// Discussion documentation of documented token ([SourceKitRepresentable]).
case docDiscussion = "key.doc.discussion"
/// File where the documented token is located (String).
@@ -65,6 +67,8 @@ public enum SwiftDocKey: String {
case docParameters = "key.doc.parameters"
/// Parsed declaration (String).
case docResultDiscussion = "key.doc.result_discussion"
+ /// Throws delimiter from documented token
+ case docThrowsDiscussion = "key.doc.throws_discussion"
/// Parsed scope start (Int64).
case docType = "key.doc.type"
/// Parsed scope start end (Int64).
@@ -90,6 +94,49 @@ public enum SwiftDocKey: String {
/// Annotations ([String]).
case annotations = "key.annotations"
+ // MARK: Delimiters extracted from discussion
+
+ /// Content of `- attention:` delimiter
+ case docAttention = "key.doc.attention"
+ /// Content of `- author:` delimiter
+ case docAuthor = "key.doc.author"
+ /// Content of `- authors:` delimiter
+ case docAuthors = "key.doc.authors"
+ /// Content of `- bug:` delimiter
+ case docBug = "key.doc.bug"
+ /// Content of `- complexity:` delimiter
+ case docComplexity = "key.doc.complexity"
+ /// Content of `- copyright:` delimiter
+ case docCopyright = "key.doc.copyright"
+ /// Content of `- date:` delimiter
+ case docDate = "key.doc.date"
+ /// Content of `- experiment:` delimiter
+ case docExperiment = "key.doc.experiment"
+ /// Content of `- important:` delimiter
+ case docImportant = "key.doc.important"
+ /// Content of `- invariant:` delimiter
+ case docInvariant = "key.doc.invariant"
+ /// Content of `- note:` delimiter
+ case docNote = "key.doc.note"
+ /// Content of `- postcondition:` delimiter
+ case docPostcondition = "key.doc.postcondition"
+ /// Content of `- precondition:` delimiter
+ case docPrecondition = "key.doc.precondition"
+ /// Content of `- remark:` delimiter
+ case docRemark = "key.doc.remark"
+ /// Content of `- requires:` delimiter
+ case docRequires = "key.doc.requires"
+ /// Content of `- see:` and `- seealso:` delimiters
+ case docSeeAlso = "key.doc.see_also"
+ /// Content of `- since:` delimiter
+ case docSince = "key.doc.since"
+ /// Content of `- toDo:` delimiter
+ case docToDo = "key.doc.to_do"
+ /// Content of `- version:` delimiter
+ case docVersion = "key.doc.version"
+ /// Content of `- warning:` delimiter
+ case docWarning = "key.doc.warning"
+
// MARK: Typed SwiftDocKey Getters
/**
diff --git a/Tests/SourceKittenFrameworkTests/Fixtures/Bicycle@swift-5.0.json b/Tests/SourceKittenFrameworkTests/Fixtures/Bicycle@swift-5.0.json
index 405846175..c516a4275 100644
--- a/Tests/SourceKittenFrameworkTests/Fixtures/Bicycle@swift-5.0.json
+++ b/Tests/SourceKittenFrameworkTests/Fixtures/Bicycle@swift-5.0.json
@@ -53,6 +53,11 @@
],
"key.bodylength" : 2222,
"key.bodyoffset" : 248,
+ "key.doc.abstract" : [
+ {
+ "Para" : "š² A two-wheeled, human-powered mode of transportation."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.comment" : "š² A two-wheeled, human-powered mode of transportation.",
"key.doc.declaration" : "public class Bicycle",
@@ -88,6 +93,11 @@
],
"key.bodylength" : 49,
"key.bodyoffset" : 492,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Frame and construction style."
+ }
+ ],
"key.doc.column" : 17,
"key.doc.comment" : "Frame and construction style.\n\n- Road: For streets or trails.\n- Touring: For long journeys.\n- Cruiser: For casual trips around town.\n- Hybrid: For general-purpose transportation.",
"key.doc.declaration" : "public enum Bicycle.Bicycle.Style",
@@ -213,6 +223,11 @@
],
"key.bodylength" : 60,
"key.bodyoffset" : 733,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Mechanism for converting pedal power into motion."
+ }
+ ],
"key.doc.column" : 17,
"key.doc.comment" : "Mechanism for converting pedal power into motion.\n\n- Fixed: A single, fixed gear.\n- Freewheel: A variable-speed, disengageable gear.",
"key.doc.declaration" : "public enum Bicycle.Bicycle.Gearing",
@@ -304,6 +319,11 @@
"key.annotated_decl" : "enum Bicycle<\/Type>.Handlebar<\/Declaration>",
"key.bodylength" : 47,
"key.bodyoffset" : 1009,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Hardware used for steering."
+ }
+ ],
"key.doc.column" : 10,
"key.doc.comment" : "Hardware used for steering.\n\n- Riser: A casual handlebar.\n- CafƩ: An upright handlebar.\n- Drop: A classic handlebar.\n- Bullhorn: A powerful handlebar.",
"key.doc.declaration" : "enum Bicycle.Bicycle.Handlebar",
@@ -420,6 +440,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "let style: Style<\/Type><\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "The style of the bicycle."
+ }
+ ],
"key.doc.column" : 9,
"key.doc.comment" : "The style of the bicycle.",
"key.doc.declaration" : "let style: Style",
@@ -448,6 +473,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "let gearing: Gearing<\/Type><\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "The gearing of the bicycle."
+ }
+ ],
"key.doc.column" : 9,
"key.doc.comment" : "The gearing of the bicycle.",
"key.doc.declaration" : "let gearing: Gearing",
@@ -476,6 +506,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "let handlebar: Handlebar<\/Type><\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "The handlebar of the bicycle."
+ }
+ ],
"key.doc.column" : 9,
"key.doc.comment" : "The handlebar of the bicycle.",
"key.doc.declaration" : "let handlebar: Handlebar",
@@ -504,6 +539,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "let frameSize: Int<\/Type><\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "The size of the frame, in centimeters."
+ }
+ ],
"key.doc.column" : 9,
"key.doc.comment" : "The size of the frame, in centimeters.",
"key.doc.declaration" : "let frameSize: Int",
@@ -539,6 +579,11 @@
"key.offset" : 1374
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "The number of trips travelled by the bicycle."
+ }
+ ],
"key.doc.column" : 22,
"key.doc.comment" : "The number of trips travelled by the bicycle.",
"key.doc.declaration" : "private(set) var numberOfTrips: Int {\n get\n }",
@@ -575,6 +620,11 @@
"key.offset" : 1479
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "The total distance travelled by the bicycle, in meters."
+ }
+ ],
"key.doc.column" : 22,
"key.doc.comment" : "The total distance travelled by the bicycle, in meters.",
"key.doc.declaration" : "private(set) var distanceTravelled: Double {\n get\n }",
@@ -606,6 +656,11 @@
"key.annotated_decl" : "init(style: Style<\/Type>, gearing: Gearing<\/Type>, handlebar: Handlebar<\/Type>, frameSize centimeters: Int<\/Type>)<\/Declaration>",
"key.bodylength" : 192,
"key.bodyoffset" : 2010,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Initializes a new bicycle with the provided parts and specifications."
+ }
+ ],
"key.doc.column" : 5,
"key.doc.comment" : "Initializes a new bicycle with the provided parts and specifications.\n\n- parameter style: The style of the bicycle\n- parameter gearing: The gearing of the bicycle\n- parameter handlebar: The handlebar of the bicycle\n- parameter centimeters: The frame size of the bicycle, in centimeters\n\n- returns: A beautiful, brand-new, custom built just for you.",
"key.doc.declaration" : "init(style: Style, gearing: Gearing, handlebar: Handlebar, frameSize centimeters: Int)",
@@ -678,6 +733,11 @@
"key.annotated_decl" : "func travel(distance meters: Double<\/Type>)<\/Declaration>",
"key.bodylength" : 112,
"key.bodyoffset" : 2356,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Take a bike out for a spin."
+ }
+ ],
"key.doc.column" : 10,
"key.doc.comment" : "Take a bike out for a spin.\n\n- parameter meters: The distance to travel in meters.",
"key.doc.declaration" : "func travel(distance meters: Double)",
diff --git a/Tests/SourceKittenFrameworkTests/Fixtures/Bicycle@swift-5.1.json b/Tests/SourceKittenFrameworkTests/Fixtures/Bicycle@swift-5.1.json
index 90d47f8f1..7771b73ee 100644
--- a/Tests/SourceKittenFrameworkTests/Fixtures/Bicycle@swift-5.1.json
+++ b/Tests/SourceKittenFrameworkTests/Fixtures/Bicycle@swift-5.1.json
@@ -53,6 +53,11 @@
],
"key.bodylength" : 2222,
"key.bodyoffset" : 248,
+ "key.doc.abstract" : [
+ {
+ "Para" : "š² A two-wheeled, human-powered mode of transportation."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.comment" : "š² A two-wheeled, human-powered mode of transportation.",
"key.doc.declaration" : "public class Bicycle",
@@ -88,6 +93,11 @@
],
"key.bodylength" : 49,
"key.bodyoffset" : 492,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Frame and construction style."
+ }
+ ],
"key.doc.column" : 17,
"key.doc.comment" : "Frame and construction style.\n\n- Road: For streets or trails.\n- Touring: For long journeys.\n- Cruiser: For casual trips around town.\n- Hybrid: For general-purpose transportation.",
"key.doc.declaration" : "public enum Bicycle.Bicycle.Style",
@@ -213,6 +223,11 @@
],
"key.bodylength" : 60,
"key.bodyoffset" : 733,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Mechanism for converting pedal power into motion."
+ }
+ ],
"key.doc.column" : 17,
"key.doc.comment" : "Mechanism for converting pedal power into motion.\n\n- Fixed: A single, fixed gear.\n- Freewheel: A variable-speed, disengageable gear.",
"key.doc.declaration" : "public enum Bicycle.Bicycle.Gearing",
@@ -304,6 +319,11 @@
"key.annotated_decl" : "enum Bicycle<\/Type>.Handlebar<\/Declaration>",
"key.bodylength" : 47,
"key.bodyoffset" : 1009,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Hardware used for steering."
+ }
+ ],
"key.doc.column" : 10,
"key.doc.comment" : "Hardware used for steering.\n\n- Riser: A casual handlebar.\n- CafƩ: An upright handlebar.\n- Drop: A classic handlebar.\n- Bullhorn: A powerful handlebar.",
"key.doc.declaration" : "enum Bicycle.Bicycle.Handlebar",
@@ -420,6 +440,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "let style: Style<\/Type><\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "The style of the bicycle."
+ }
+ ],
"key.doc.column" : 9,
"key.doc.comment" : "The style of the bicycle.",
"key.doc.declaration" : "let style: Style",
@@ -448,6 +473,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "let gearing: Gearing<\/Type><\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "The gearing of the bicycle."
+ }
+ ],
"key.doc.column" : 9,
"key.doc.comment" : "The gearing of the bicycle.",
"key.doc.declaration" : "let gearing: Gearing",
@@ -476,6 +506,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "let handlebar: Handlebar<\/Type><\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "The handlebar of the bicycle."
+ }
+ ],
"key.doc.column" : 9,
"key.doc.comment" : "The handlebar of the bicycle.",
"key.doc.declaration" : "let handlebar: Handlebar",
@@ -504,6 +539,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "let frameSize: Int<\/Type><\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "The size of the frame, in centimeters."
+ }
+ ],
"key.doc.column" : 9,
"key.doc.comment" : "The size of the frame, in centimeters.",
"key.doc.declaration" : "let frameSize: Int",
@@ -539,6 +579,11 @@
"key.offset" : 1374
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "The number of trips travelled by the bicycle."
+ }
+ ],
"key.doc.column" : 22,
"key.doc.comment" : "The number of trips travelled by the bicycle.",
"key.doc.declaration" : "private(set) var numberOfTrips: Int {\n get\n }",
@@ -575,6 +620,11 @@
"key.offset" : 1479
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "The total distance travelled by the bicycle, in meters."
+ }
+ ],
"key.doc.column" : 22,
"key.doc.comment" : "The total distance travelled by the bicycle, in meters.",
"key.doc.declaration" : "private(set) var distanceTravelled: Double {\n get\n }",
@@ -606,6 +656,11 @@
"key.annotated_decl" : "init(style: Style<\/Type>, gearing: Gearing<\/Type>, handlebar: Handlebar<\/Type>, frameSize centimeters: Int<\/Type>)<\/Declaration>",
"key.bodylength" : 192,
"key.bodyoffset" : 2010,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Initializes a new bicycle with the provided parts and specifications."
+ }
+ ],
"key.doc.column" : 5,
"key.doc.comment" : "Initializes a new bicycle with the provided parts and specifications.\n\n- parameter style: The style of the bicycle\n- parameter gearing: The gearing of the bicycle\n- parameter handlebar: The handlebar of the bicycle\n- parameter centimeters: The frame size of the bicycle, in centimeters\n\n- returns: A beautiful, brand-new, custom built just for you.",
"key.doc.declaration" : "init(style: Style, gearing: Gearing, handlebar: Handlebar, frameSize centimeters: Int)",
@@ -678,6 +733,11 @@
"key.annotated_decl" : "func travel(distance meters: Double<\/Type>)<\/Declaration>",
"key.bodylength" : 112,
"key.bodyoffset" : 2356,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Take a bike out for a spin."
+ }
+ ],
"key.doc.column" : 10,
"key.doc.comment" : "Take a bike out for a spin.\n\n- parameter meters: The distance to travel in meters.",
"key.doc.declaration" : "func travel(distance meters: Double)",
diff --git a/Tests/SourceKittenFrameworkTests/Fixtures/Commandant@swift-5.0.json b/Tests/SourceKittenFrameworkTests/Fixtures/Commandant@swift-5.0.json
index 51acbd176..91fb365d6 100644
--- a/Tests/SourceKittenFrameworkTests/Fixtures/Commandant@swift-5.0.json
+++ b/Tests/SourceKittenFrameworkTests/Fixtures/Commandant@swift-5.0.json
@@ -16,6 +16,11 @@
],
"key.bodylength" : 1029,
"key.bodyoffset" : 231,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes an argument that can be provided on the command line."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Describes an argument that can be provided on the command line.",
"key.doc.declaration" : "public struct Argument",
@@ -65,6 +70,11 @@
"key.offset" : 443
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "The default value for this argument. This is the value that will be used if the argument is never explicitly specified on the command line."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "The default value for this argument. This is the value that will be used\nif the argument is never explicitly specified on the command line.\n\nIf this is nil, this argument is always required.",
"key.doc.declaration" : "public let defaultValue: T?",
@@ -105,6 +115,11 @@
"key.offset" : 585
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "A human-readable string describing the purpose of this argument. This will be shown in help messages."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "A human-readable string describing the purpose of this argument. This will\nbe shown in help messages.",
"key.doc.declaration" : "public let usage: String",
@@ -140,6 +155,11 @@
"key.offset" : 804
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "A human-readable string that describes this argument as a paramater shown in the list of possible parameters in help messages (e.g. for āpathsā, the user would see )."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "A human-readable string that describes this argument as a paramater shown\nin the list of possible parameters in help messages (e.g. for \"paths\", the\nuser would see ).",
"key.doc.declaration" : "public let usageParameter: String?",
@@ -268,6 +288,11 @@
"key.annotated_decl" : "public struct Argument<T><\/Declaration>",
"key.bodylength" : 251,
"key.bodyoffset" : 1283,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes an argument that can be provided on the command line."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.declaration" : "public struct Argument",
"key.doc.file" : "Sources\/Commandant\/Argument.swift",
@@ -299,6 +324,11 @@
],
"key.bodylength" : 62,
"key.bodyoffset" : 1470,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A string describing this argument as a parameter in help messages. This falls back to `\"\\(self)\"` if `usageParameter` is `nil`"
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "A string describing this argument as a parameter in help messages. This falls back\nto `\"\\(self)\"` if `usageParameter` is `nil`",
"key.doc.declaration" : "internal var usageParameterDescription: String { get }",
@@ -339,6 +369,11 @@
"key.annotated_decl" : "public struct Argument<T><\/Declaration>",
"key.bodylength" : 254,
"key.bodyoffset" : 1575,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes an argument that can be provided on the command line."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.declaration" : "public struct Argument",
"key.doc.file" : "Sources\/Commandant\/Argument.swift",
@@ -370,6 +405,11 @@
],
"key.bodylength" : 65,
"key.bodyoffset" : 1762,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A string describing this argument as a parameter in help messages. This falls back to `\"\\(self)\"` if `usageParameter` is `nil`"
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "A string describing this argument as a parameter in help messages. This falls back\nto `\"\\(self)\"` if `usageParameter` is `nil`",
"key.doc.declaration" : "internal var usageParameterDescription: String { get }",
@@ -418,6 +458,11 @@
"key.annotated_decl" : "public enum CommandMode<\/Declaration>",
"key.bodylength" : 1979,
"key.bodyoffset" : 1877,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes the āmodeā in which a command should run."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.declaration" : "public enum CommandMode",
"key.doc.file" : "Sources\/Commandant\/Command.swift",
@@ -449,6 +494,11 @@
],
"key.bodylength" : 518,
"key.bodyoffset" : 2212,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates the given argument in the given mode."
+ }
+ ],
"key.doc.column" : 21,
"key.doc.comment" : "Evaluates the given argument in the given mode.\n\nIf parsing command line arguments, and no value was specified on the command\nline, the argument's `defaultValue` is used.",
"key.doc.declaration" : "public static func <| (mode: CommandMode, argument: Argument) -> Result> where T : ArgumentProtocol",
@@ -562,6 +612,11 @@
],
"key.bodylength" : 778,
"key.bodyoffset" : 3076,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates the given argument list in the given mode."
+ }
+ ],
"key.doc.column" : 21,
"key.doc.comment" : "Evaluates the given argument list in the given mode.\n\nIf parsing command line arguments, and no value was specified on the command\nline, the argument's `defaultValue` is used.",
"key.doc.declaration" : "public static func <| (mode: CommandMode, argument: Argument<[T]>) -> Result<[T], CommandantError> where T : ArgumentProtocol",
@@ -688,6 +743,11 @@
],
"key.bodylength" : 296,
"key.bodyoffset" : 266,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Represents an argument passed on the command line."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.comment" : "Represents an argument passed on the command line.",
"key.doc.declaration" : "private enum RawArgument : Equatable",
@@ -732,6 +792,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "case key(String<\/Type>)<\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "A key corresponding to an option (e.g., `verbose` for `--verbose`)."
+ }
+ ],
"key.doc.column" : 7,
"key.doc.comment" : "A key corresponding to an option (e.g., `verbose` for `--verbose`).",
"key.doc.declaration" : "",
@@ -769,6 +834,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "case value(String<\/Type>)<\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "A value, either associated with an option or passed as a positional argument."
+ }
+ ],
"key.doc.column" : 7,
"key.doc.comment" : "A value, either associated with an option or passed as a positional\nargument.",
"key.doc.declaration" : "",
@@ -806,6 +876,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "case flag(OrderedSet<\/Type><Character<\/Type>>)<\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "One or more flag arguments (e.g ārā and āfā for `-rf`)"
+ }
+ ],
"key.doc.column" : 7,
"key.doc.comment" : "One or more flag arguments (e.g 'r' and 'f' for `-rf`)",
"key.doc.declaration" : "",
@@ -843,6 +918,11 @@
"key.annotated_decl" : "private enum RawArgument : Equatable<\/Type><\/Declaration>",
"key.bodylength" : 214,
"key.bodyoffset" : 613,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Represents an argument passed on the command line."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.declaration" : "private enum RawArgument : Equatable",
"key.doc.file" : "Sources\/Commandant\/ArgumentParser.swift",
@@ -886,6 +966,11 @@
],
"key.bodylength" : 173,
"key.bodyoffset" : 652,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A textual representation of this instance."
+ }
+ ],
"key.doc.declaration" : "var description: String { get }",
"key.doc.discussion" : [
{
@@ -943,6 +1028,11 @@
],
"key.bodylength" : 3711,
"key.bodyoffset" : 924,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Destructively parses a list of command-line arguments."
+ }
+ ],
"key.doc.column" : 20,
"key.doc.comment" : "Destructively parses a list of command-line arguments.",
"key.doc.declaration" : "public final class ArgumentParser",
@@ -976,6 +1066,11 @@
"key.offset" : 991
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "The remaining arguments to be extracted, in their raw form."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.comment" : "The remaining arguments to be extracted, in their raw form.",
"key.doc.declaration" : "private var rawArguments: [Commandant.RawArgument]",
@@ -1014,6 +1109,11 @@
],
"key.bodylength" : 741,
"key.bodyoffset" : 1151,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Initializes the generator from a simple list of command-line arguments."
+ }
+ ],
"key.doc.column" : 9,
"key.doc.comment" : "Initializes the generator from a simple list of command-line arguments.",
"key.doc.declaration" : "public init(_ arguments: [String])",
@@ -1087,6 +1187,11 @@
],
"key.bodylength" : 76,
"key.bodyoffset" : 1978,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Returns the remaining arguments."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Returns the remaining arguments.",
"key.doc.declaration" : "internal var remainingArguments: [String]? { get }",
@@ -1124,6 +1229,11 @@
],
"key.bodylength" : 281,
"key.bodyoffset" : 2323,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Returns whether the given key was enabled or disabled, or nil if it was not given at all."
+ }
+ ],
"key.doc.column" : 16,
"key.doc.comment" : "Returns whether the given key was enabled or disabled, or nil if it\nwas not given at all.\n\nIf the key is found, it is then removed from the list of arguments\nremaining to be parsed.",
"key.doc.declaration" : "internal func consumeBoolean(forKey key: String) -> Bool?",
@@ -1207,6 +1317,11 @@
],
"key.bodylength" : 503,
"key.bodyoffset" : 2999,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Returns the value associated with the given flag, or nil if the flag was not specified. If the key is presented, but no value was given, an error is returned."
+ }
+ ],
"key.doc.column" : 16,
"key.doc.comment" : "Returns the value associated with the given flag, or nil if the flag was\nnot specified. If the key is presented, but no value was given, an error\nis returned.\n\nIf a value is found, the key and the value are both removed from the\nlist of arguments remaining to be parsed.",
"key.doc.declaration" : "internal func consumeValue(forKey key: String) -> Result>",
@@ -1307,6 +1422,11 @@
],
"key.bodylength" : 164,
"key.bodyoffset" : 3688,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Returns the next positional argument that hasnāt yet been returned, or nil if there are no more positional arguments."
+ }
+ ],
"key.doc.column" : 16,
"key.doc.comment" : "Returns the next positional argument that hasn't yet been returned, or\nnil if there are no more positional arguments.",
"key.doc.declaration" : "internal func consumePositionalArgument() -> String?",
@@ -1347,6 +1467,11 @@
],
"key.bodylength" : 143,
"key.bodyoffset" : 4007,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Returns whether the given key was specified and removes it from the list of arguments remaining."
+ }
+ ],
"key.doc.column" : 16,
"key.doc.comment" : "Returns whether the given key was specified and removes it from the\nlist of arguments remaining.",
"key.doc.declaration" : "internal func consume(key: String) -> Bool",
@@ -1403,6 +1528,11 @@
],
"key.bodylength" : 316,
"key.bodyoffset" : 4317,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Returns whether the given flag was specified and removes it from the list of arguments remaining."
+ }
+ ],
"key.doc.column" : 16,
"key.doc.comment" : "Returns whether the given flag was specified and removes it from the\nlist of arguments remaining.",
"key.doc.declaration" : "internal func consumeBoolean(flag: Character) -> Bool",
@@ -1461,6 +1591,11 @@
],
"key.bodylength" : 189,
"key.bodyoffset" : 253,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Represents a value that can be converted from a command-line argument."
+ }
+ ],
"key.doc.column" : 17,
"key.doc.comment" : "Represents a value that can be converted from a command-line argument.",
"key.doc.declaration" : "public protocol ArgumentProtocol",
@@ -1489,6 +1624,11 @@
"key.annotated_decl" : "static var name: String<\/Type> { get }<\/Declaration>",
"key.bodylength" : 5,
"key.bodyoffset" : 322,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A human-readable name for this type."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "A human-readable name for this type.",
"key.doc.declaration" : "static var name: String { get }",
@@ -1517,6 +1657,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.public",
"key.annotated_decl" : "static func from(string: String<\/Type>) -> `Self`?<\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "Attempts to parse a value from the given command-line argument."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.comment" : "Attempts to parse a value from the given command-line argument.",
"key.doc.declaration" : "static func from(string: String) -> `Self`?",
@@ -1555,6 +1700,11 @@
"key.annotated_decl" : "struct Int : FixedWidthInteger<\/Type>, SignedInteger<\/Type><\/Declaration>",
"key.bodylength" : 113,
"key.bodyoffset" : 478,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A signed integer value type."
+ }
+ ],
"key.doc.declaration" : "struct Int : FixedWidthInteger, SignedInteger",
"key.doc.discussion" : [
{
@@ -1600,6 +1750,11 @@
"key.offset" : 480
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "A human-readable name for this type."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.declaration" : "static var name: String { get }",
"key.doc.file" : "Sources\/Commandant\/ArgumentProtocol.swift",
@@ -1640,6 +1795,11 @@
],
"key.bodylength" : 23,
"key.bodyoffset" : 566,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Attempts to parse a value from the given command-line argument."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.declaration" : "static func from(string: String) -> `Self`?",
"key.doc.file" : "Sources\/Commandant\/ArgumentProtocol.swift",
@@ -1681,19 +1841,24 @@
"key.annotated_decl" : "struct String<\/Declaration>",
"key.bodylength" : 110,
"key.bodyoffset" : 630,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A Unicode string value that is a collection of characters."
+ }
+ ],
"key.doc.declaration" : "struct String",
"key.doc.discussion" : [
{
"Para" : "A string is a series of characters, such as `\"Swift\"`, that forms a collection. Strings in Swift are Unicode correct and locale insensitive, and are designed to be efficient. The `String` type bridges with the Objective-C class `NSString` and offers interoperability with C functions that works with strings."
},
{
- "Para" : "You can create new strings using string literals or string interpolations. A is a series of characters enclosed in quotes."
+ "Para" : "You can create new strings using string literals or string interpolations. A _string literal_ is a series of characters enclosed in quotes."
},
{
"CodeListing" : ""
},
{
- "Para" : " are string literals that evaluate any included expressions and convert the results to string form. String interpolations give you an easy way to build a string from multiple pieces. Wrap each expression in a string interpolation in parentheses, prefixed by a backslash."
+ "Para" : "_String interpolations_ are string literals that evaluate any included expressions and convert the results to string form. String interpolations give you an easy way to build a string from multiple pieces. Wrap each expression in a string interpolation in parentheses, prefixed by a backslash."
},
{
"CodeListing" : ""
@@ -1729,7 +1894,7 @@
"Para" : "Basic string operations are not sensitive to locale settings, ensuring that string comparisons and other operations always have a single, stable result, allowing strings to be used as keys in `Dictionary` instances and for other purposes."
},
{
- "Para" : "A string is a collection of , which approximate human-readable characters. Many individual characters, such as āĆ©ā, āź¹ā, and āš®š³ā, can be made up of multiple Unicode scalar values. These scalar values are combined by Unicodeās boundary algorithms into extended grapheme clusters, represented by the Swift `Character` type. Each element of a string is represented by a `Character` instance."
+ "Para" : "A string is a collection of _extended grapheme clusters_, which approximate human-readable characters. Many individual characters, such as āĆ©ā, āź¹ā, and āš®š³ā, can be made up of multiple Unicode scalar values. These scalar values are combined by Unicodeās boundary algorithms into extended grapheme clusters, represented by the Swift `Character` type. Each element of a string is represented by a `Character` instance."
},
{
"Para" : "For example, to retrieve the first word of a longer string, you can search for a space and then create a substring from a prefix of the string up to that point:"
@@ -1795,7 +1960,7 @@
"Para" : "When you need to know the length of a string, you must first consider what youāll use the length for. Are you measuring the number of characters that will be displayed on the screen, or are you measuring the amount of storage needed for the string in a particular encoding? A single string can have greatly differing lengths when measured by its different views."
},
{
- "Para" : "For example, an ASCII character like the capital letter is represented by a single element in each of its four views. The Unicode scalar value of is `65`, which is small enough to fit in a single code unit in both UTF-16 and UTF-8."
+ "Para" : "For example, an ASCII character like the capital letter _A_ is represented by a single element in each of its four views. The Unicode scalar value of _A_ is `65`, which is small enough to fit in a single code unit in both UTF-16 and UTF-8."
},
{
"CodeListing" : ""
@@ -1840,13 +2005,13 @@
"CodeListing" : ""
},
{
- "Para" : "Although strings in Swift have value semantics, strings use a copy-on-write strategy to store their data in a buffer. This buffer can then be shared by different copies of a string. A stringās data is only copied lazily, upon mutation, when more than one string instance is using the same buffer. Therefore, the first in any sequence of mutating operations may cost O() time and space."
+ "Para" : "Although strings in Swift have value semantics, strings use a copy-on-write strategy to store their data in a buffer. This buffer can then be shared by different copies of a string. A stringās data is only copied lazily, upon mutation, when more than one string instance is using the same buffer. Therefore, the first in any sequence of mutating operations may cost O(_n_) time and space."
},
{
"Para" : "When a stringās contiguous storage fills up, a new buffer must be allocated and data must be moved to the new storage. String buffers use an exponential growth strategy that makes appending to a string a constant time operation when averaged over many append operations."
},
{
- "Para" : "Any `String` instance can be bridged to `NSString` using the type-cast operator (`as`), and any `String` instance that originates in Objective-C may use an `NSString` instance as its storage. Because any arbitrary subclass of `NSString` can become a `String` instance, there are no guarantees about representation or efficiency when a `String` instance is backed by `NSString` storage. Because `NSString` is immutable, it is just as though the storage was shared by a copy. The first in any sequence of mutating operations causes elements to be copied into unique, contiguous storage which may cost O() time and space, where is the length of the stringās encoded representation (or more, if the underlying `NSString` has unusual performance characteristics)."
+ "Para" : "Any `String` instance can be bridged to `NSString` using the type-cast operator (`as`), and any `String` instance that originates in Objective-C may use an `NSString` instance as its storage. Because any arbitrary subclass of `NSString` can become a `String` instance, there are no guarantees about representation or efficiency when a `String` instance is backed by `NSString` storage. Because `NSString` is immutable, it is just as though the storage was shared by a copy. The first in any sequence of mutating operations causes elements to be copied into unique, contiguous storage which may cost O(_n_) time and space, where _n_ is the length of the stringās encoded representation (or more, if the underlying `NSString` has unusual performance characteristics)."
},
{
"Para" : "For more information about the Unicode terms used in this discussion, see the . In particular, this discussion mentions , , and ."
@@ -1891,6 +2056,11 @@
"key.offset" : 632
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "A human-readable name for this type."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.declaration" : "static var name: String { get }",
"key.doc.file" : "Sources\/Commandant\/ArgumentProtocol.swift",
@@ -1931,6 +2101,11 @@
],
"key.bodylength" : 18,
"key.bodyoffset" : 720,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Attempts to parse a value from the given command-line argument."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.declaration" : "static func from(string: String) -> `Self`?",
"key.doc.file" : "Sources\/Commandant\/ArgumentProtocol.swift",
@@ -1972,6 +2147,11 @@
"key.annotated_decl" : "protocol RawRepresentable<\/Declaration>",
"key.bodylength" : 112,
"key.bodyoffset" : 826,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A type that can be converted to and from an associated raw value."
+ }
+ ],
"key.doc.declaration" : "protocol RawRepresentable",
"key.doc.discussion" : [
{
@@ -1990,7 +2170,7 @@
"CodeListing" : ""
},
{
- "Para" : "You can create a `Counter` instance from an integer value between 1 and 5 by using the `init?(rawValue:)` initializer declared in the `RawRepresentable` protocol. This initializer is failable because although every case of the `Counter` type has a corresponding `Int` value, there are many `Int` values that correspond to a case of `Counter`."
+ "Para" : "You can create a `Counter` instance from an integer value between 1 and 5 by using the `init?(rawValue:)` initializer declared in the `RawRepresentable` protocol. This initializer is failable because although every case of the `Counter` type has a corresponding `Int` value, there are many `Int` values that _donāt_ correspond to a case of `Counter`."
},
{
"CodeListing" : ""
@@ -2083,6 +2263,11 @@
"key.annotated_decl" : "protocol RawRepresentable<\/Declaration>",
"key.bodylength" : 112,
"key.bodyoffset" : 1027,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A type that can be converted to and from an associated raw value."
+ }
+ ],
"key.doc.declaration" : "protocol RawRepresentable",
"key.doc.discussion" : [
{
@@ -2101,7 +2286,7 @@
"CodeListing" : ""
},
{
- "Para" : "You can create a `Counter` instance from an integer value between 1 and 5 by using the `init?(rawValue:)` initializer declared in the `RawRepresentable` protocol. This initializer is failable because although every case of the `Counter` type has a corresponding `Int` value, there are many `Int` values that correspond to a case of `Counter`."
+ "Para" : "You can create a `Counter` instance from an integer value between 1 and 5 by using the `init?(rawValue:)` initializer declared in the `RawRepresentable` protocol. This initializer is failable because although every case of the `Counter` type has a corresponding `Int` value, there are many `Int` values that _donāt_ correspond to a case of `Counter`."
},
{
"CodeListing" : ""
@@ -2209,6 +2394,11 @@
],
"key.bodylength" : 483,
"key.bodyoffset" : 280,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Represents a subcommand that can be executed with its own set of arguments."
+ }
+ ],
"key.doc.column" : 17,
"key.doc.comment" : "Represents a subcommand that can be executed with its own set of arguments.",
"key.doc.declaration" : "public protocol CommandProtocol",
@@ -2235,6 +2425,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.public",
"key.annotated_decl" : "associatedtype Options : OptionsProtocol<\/Type><\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "The commandās options type."
+ }
+ ],
"key.doc.column" : 17,
"key.doc.comment" : "The command's options type.",
"key.doc.declaration" : "associatedtype Options : OptionsProtocol",
@@ -2283,6 +2478,11 @@
"key.annotated_decl" : "var verb: String<\/Type> { get }<\/Declaration>",
"key.bodylength" : 5,
"key.bodyoffset" : 532,
+ "key.doc.abstract" : [
+ {
+ "Para" : "The action that users should specify to use this subcommand (e.g., `help`)."
+ }
+ ],
"key.doc.column" : 6,
"key.doc.comment" : "The action that users should specify to use this subcommand (e.g.,\n`help`).",
"key.doc.declaration" : "var verb: String { get }",
@@ -2313,6 +2513,11 @@
"key.annotated_decl" : "var function: String<\/Type> { get }<\/Declaration>",
"key.bodylength" : 5,
"key.bodyoffset" : 648,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A human-readable, high-level description of what this command is used for."
+ }
+ ],
"key.doc.column" : 6,
"key.doc.comment" : "A human-readable, high-level description of what this command is used\nfor.",
"key.doc.declaration" : "var function: String { get }",
@@ -2341,6 +2546,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.public",
"key.annotated_decl" : "func run(_ options: Options<\/Type>) -> Result<\/Type><(), ClientError<\/Type>><\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "Runs this subcommand with the given options."
+ }
+ ],
"key.doc.column" : 7,
"key.doc.comment" : "Runs this subcommand with the given options.",
"key.doc.declaration" : "func run(_ options: Options) -> Result<(), ClientError>",
@@ -2386,6 +2596,11 @@
],
"key.bodylength" : 957,
"key.bodyoffset" : 843,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A type-erased command."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "A type-erased command.",
"key.doc.declaration" : "public struct CommandWrapper where ClientError : Error",
@@ -2549,6 +2764,11 @@
],
"key.bodylength" : 633,
"key.bodyoffset" : 1165,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Creates a command that wraps another."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.comment" : "Creates a command that wraps another.",
"key.doc.declaration" : "fileprivate init(_ command: C) where ClientError == C.ClientError, C : CommandProtocol",
@@ -2622,6 +2842,11 @@
],
"key.bodylength" : 216,
"key.bodyoffset" : 1884,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes the āmodeā in which a command should run."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "Describes the \"mode\" in which a command should run.",
"key.doc.declaration" : "public enum CommandMode",
@@ -2654,6 +2879,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.public",
"key.annotated_decl" : "case arguments(ArgumentParser<\/Type>)<\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "Options should be parsed from the given command-line arguments."
+ }
+ ],
"key.doc.column" : 7,
"key.doc.comment" : "Options should be parsed from the given command-line arguments.",
"key.doc.declaration" : "",
@@ -2691,6 +2921,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.public",
"key.annotated_decl" : "case usage<\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "Each option should record its usage information in an error, for presentation to the user."
+ }
+ ],
"key.doc.column" : 7,
"key.doc.comment" : "Each option should record its usage information in an error, for\npresentation to the user.",
"key.doc.declaration" : "",
@@ -2740,6 +2975,11 @@
],
"key.bodylength" : 1204,
"key.bodyoffset" : 2212,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Maintains the list of commands available to run."
+ }
+ ],
"key.doc.column" : 20,
"key.doc.comment" : "Maintains the list of commands available to run.",
"key.doc.declaration" : "public final class CommandRegistry where ClientError : Error",
@@ -2829,6 +3069,11 @@
],
"key.bodylength" : 69,
"key.bodyoffset" : 2369,
+ "key.doc.abstract" : [
+ {
+ "Para" : "All available commands."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "All available commands.",
"key.doc.declaration" : "public var commands: [CommandWrapper] { get }",
@@ -2898,6 +3143,11 @@
],
"key.bodylength" : 106,
"key.bodyoffset" : 2775,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Registers the given commands, making those available to run."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.comment" : "Registers the given commands, making those available to run.\n\nIf another commands were already registered with the same `verb`s, those\nwill be overwritten.",
"key.doc.declaration" : "public func register(_ commands: C...) -> CommandRegistry where ClientError == C.ClientError, C : CommandProtocol",
@@ -2971,6 +3221,11 @@
],
"key.bodylength" : 54,
"key.bodyoffset" : 3164,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Runs the command corresponding to the given verb, passing it the given arguments."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.comment" : "Runs the command corresponding to the given verb, passing it the given\narguments.\n\nReturns the results of the execution, or nil if no such command exists.",
"key.doc.declaration" : "public func run(command verb: String, arguments: [String]) -> Result<(), CommandantError>?",
@@ -3016,6 +3271,11 @@
],
"key.bodylength" : 32,
"key.bodyoffset" : 3382,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Returns the command matching the given verb, or nil if no such command is registered."
+ }
+ ],
"key.doc.column" : 9,
"key.doc.comment" : "Returns the command matching the given verb, or nil if no such command\nis registered.",
"key.doc.declaration" : "public subscript(verb: String) -> CommandWrapper? { get }",
@@ -3054,6 +3314,11 @@
"key.annotated_decl" : "public final class CommandRegistry<ClientError> where ClientError : Error<\/Type><\/Declaration>",
"key.bodylength" : 4074,
"key.bodyoffset" : 3446,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Maintains the list of commands available to run."
+ }
+ ],
"key.doc.column" : 20,
"key.doc.declaration" : "public final class CommandRegistry where ClientError : Error",
"key.doc.file" : "Sources\/Commandant\/Command.swift",
@@ -3085,6 +3350,11 @@
],
"key.bodylength" : 97,
"key.bodyoffset" : 4332,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Hands off execution to the CommandRegistry, by parsing CommandLine.arguments and then running whichever command has been identified in the argument list."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.comment" : "Hands off execution to the CommandRegistry, by parsing CommandLine.arguments\nand then running whichever command has been identified in the argument\nlist.\n\nIf the chosen command executes successfully, the process will exit with\na successful exit code.\n\nIf the chosen command fails, the provided error handler will be invoked,\nthen the process will exit with a failure exit code.\n\nIf a matching command could not be found but there is any `executable-verb`\nstyle subcommand executable in the caller's `$PATH`, the subcommand will\nbe executed.\n\nIf a matching command could not be found or a usage error occurred,\na helpful error message will be written to `stderr`, then the process\nwill exit with a failure error code.",
"key.doc.declaration" : "public func main(defaultVerb: String, errorHandler: (ClientError) -> Void) -> Never",
@@ -3144,6 +3414,11 @@
],
"key.bodylength" : 945,
"key.bodyoffset" : 5328,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Hands off execution to the CommandRegistry, by parsing `arguments` and then running whichever command has been identified in the argument list."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.comment" : "Hands off execution to the CommandRegistry, by parsing `arguments`\nand then running whichever command has been identified in the argument\nlist.\n\nIf the chosen command executes successfully, the process will exit with\na successful exit code.\n\nIf the chosen command fails, the provided error handler will be invoked,\nthen the process will exit with a failure exit code.\n\nIf a matching command could not be found but there is any `executable-verb`\nstyle subcommand executable in the caller's `$PATH`, the subcommand will\nbe executed.\n\nIf a matching command could not be found or a usage error occurred,\na helpful error message will be written to `stderr`, then the process\nwill exit with a failure error code.",
"key.doc.declaration" : "public func main(arguments: [String], defaultVerb: String, errorHandler: (ClientError) -> Void) -> Never",
@@ -3253,6 +3528,11 @@
],
"key.bodylength" : 933,
"key.bodyoffset" : 6585,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Finds and executes a subcommand which exists in your $PATH. The executable name must be in the form of `executable-verb`."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Finds and executes a subcommand which exists in your $PATH. The executable\nname must be in the form of `executable-verb`.\n\n- Returns: The exit status of found subcommand or nil.",
"key.doc.declaration" : "private func executeSubcommandIfExists(_ executableName: String, verb: String, arguments: [String]) -> Int32?",
@@ -3383,6 +3663,11 @@
],
"key.bodylength" : 157,
"key.bodyoffset" : 372,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Possible errors that can originate from Commandant."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "Possible errors that can originate from Commandant.\n\n`ClientError` should be the type of error (if any) that can occur when\nrunning commands.",
"key.doc.declaration" : "public enum CommandantError : Error",
@@ -3449,6 +3734,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.public",
"key.annotated_decl" : "case usageError(description: String<\/Type>)<\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "An option was used incorrectly."
+ }
+ ],
"key.doc.column" : 7,
"key.doc.comment" : "An option was used incorrectly.",
"key.doc.declaration" : "",
@@ -3486,6 +3776,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.public",
"key.annotated_decl" : "case commandError(ClientError<\/Type>)<\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "An error occurred while running a command."
+ }
+ ],
"key.doc.column" : 7,
"key.doc.comment" : "An error occurred while running a command.",
"key.doc.declaration" : "",
@@ -3523,6 +3818,11 @@
"key.annotated_decl" : "public enum CommandantError<ClientError> : Error<\/Type><\/Declaration>",
"key.bodylength" : 187,
"key.bodyoffset" : 584,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Possible errors that can originate from Commandant."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.declaration" : "public enum CommandantError : Error",
"key.doc.discussion" : [
@@ -3571,6 +3871,11 @@
],
"key.bodylength" : 151,
"key.bodyoffset" : 618,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A textual representation of this instance."
+ }
+ ],
"key.doc.declaration" : "var description: String { get }",
"key.doc.discussion" : [
{
@@ -3623,6 +3928,11 @@
],
"key.bodylength" : 105,
"key.bodyoffset" : 992,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Constructs an `InvalidArgument` error that indicates a missing value for the argument by the given name."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Constructs an `InvalidArgument` error that indicates a missing value for\nthe argument by the given name.",
"key.doc.declaration" : "internal func missingArgumentError(_ argumentName: String) -> CommandantError",
@@ -3696,6 +4006,11 @@
],
"key.bodylength" : 179,
"key.bodyoffset" : 1339,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Constructs an error by combining the example of key (and value, if applicable) with the usage description."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Constructs an error by combining the example of key (and value, if applicable)\nwith the usage description.",
"key.doc.declaration" : "internal func informativeUsageError(_ keyValueExample: String, usage: String) -> CommandantError",
@@ -3798,6 +4113,11 @@
],
"key.bodylength" : 265,
"key.bodyoffset" : 1813,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Combines the text of the two errors, if theyāre both `UsageError`s. Otherwise, uses whichever one is not (biased toward the left)."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Combines the text of the two errors, if they're both `UsageError`s.\nOtherwise, uses whichever one is not (biased toward the left).",
"key.doc.declaration" : "internal func combineUsageErrors(_ lhs: CommandantError, _ rhs: CommandantError) -> CommandantError",
@@ -3854,6 +4174,11 @@
],
"key.bodylength" : 96,
"key.bodyoffset" : 2260,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Constructs an error that indicates unrecognized arguments remains."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Constructs an error that indicates unrecognized arguments remains.",
"key.doc.declaration" : "internal func unrecognizedArgumentsError(_ options: [String]) -> CommandantError",
@@ -3918,6 +4243,11 @@
],
"key.bodylength" : 192,
"key.bodyoffset" : 2631,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Constructs an error that describes how to use the argument, with the given example of value usage if applicable."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Constructs an error that describes how to use the argument, with the given\nexample of value usage if applicable.",
"key.doc.declaration" : "internal func informativeUsageError(_ valueExample: String, argument: Argument) -> CommandantError",
@@ -4020,6 +4350,11 @@
],
"key.bodylength" : 378,
"key.bodyoffset" : 3018,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Constructs an error that describes how to use the argument."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Constructs an error that describes how to use the argument.",
"key.doc.declaration" : "internal func informativeUsageError(_ argument: Argument) -> CommandantError where T : ArgumentProtocol",
@@ -4168,6 +4503,11 @@
],
"key.bodylength" : 378,
"key.bodyoffset" : 3598,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Constructs an error that describes how to use the argument list."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Constructs an error that describes how to use the argument list.",
"key.doc.declaration" : "internal func informativeUsageError(_ argument: Argument<[T]>) -> CommandantError where T : ArgumentProtocol",
@@ -4324,6 +4664,11 @@
],
"key.bodylength" : 76,
"key.bodyoffset" : 4257,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Constructs an error that describes how to use the option, with the given example of key (and value, if applicable) usage."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Constructs an error that describes how to use the option, with the given\nexample of key (and value, if applicable) usage.",
"key.doc.declaration" : "internal func informativeUsageError(_ keyValueExample: String, option: Option) -> CommandantError",
@@ -4426,6 +4771,11 @@
],
"key.bodylength" : 89,
"key.bodyoffset" : 4522,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Constructs an error that describes how to use the option."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Constructs an error that describes how to use the option.",
"key.doc.declaration" : "internal func informativeUsageError(_ option: Option) -> CommandantError where T : ArgumentProtocol",
@@ -4540,6 +4890,11 @@
],
"key.bodylength" : 78,
"key.bodyoffset" : 4801,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Constructs an error that describes how to use the option."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Constructs an error that describes how to use the option.",
"key.doc.declaration" : "internal func informativeUsageError(_ option: Option) -> CommandantError where T : ArgumentProtocol",
@@ -4654,6 +5009,11 @@
],
"key.bodylength" : 91,
"key.bodyoffset" : 5070,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Constructs an error that describes how to use the option."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Constructs an error that describes how to use the option.",
"key.doc.declaration" : "internal func informativeUsageError(_ option: Option<[T]>) -> CommandantError where T : ArgumentProtocol",
@@ -4768,6 +5128,11 @@
],
"key.bodylength" : 78,
"key.bodyoffset" : 5353,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Constructs an error that describes how to use the option."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Constructs an error that describes how to use the option.",
"key.doc.declaration" : "internal func informativeUsageError(_ option: Option<[T]?>) -> CommandantError where T : ArgumentProtocol",
@@ -4882,6 +5247,11 @@
],
"key.bodylength" : 121,
"key.bodyoffset" : 5616,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Constructs an error that describes how to use the given boolean option."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Constructs an error that describes how to use the given boolean option.",
"key.doc.declaration" : "internal func informativeUsageError(_ option: Option) -> CommandantError",
@@ -4992,6 +5362,11 @@
],
"key.bodylength" : 1127,
"key.bodyoffset" : 601,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A basic implementation of a `help` command, using information available in a `CommandRegistry`."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "A basic implementation of a `help` command, using information available in a\n`CommandRegistry`.\n\nIf you want to use this command, initialize it with the registry, then add\nit to that same registry:\n\n\tlet commands: CommandRegistry = ā¦\n\tlet helpCommand = HelpCommand(registry: commands)\n\tcommands.register(helpCommand)",
"key.doc.declaration" : "public struct HelpCommand : CommandProtocol where ClientError : Error",
@@ -5073,6 +5448,11 @@
"key.offset" : 603
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "The commandās options type."
+ }
+ ],
"key.doc.column" : 17,
"key.doc.declaration" : "associatedtype Options : OptionsProtocol",
"key.doc.file" : "Sources\/Commandant\/Command.swift",
@@ -5110,6 +5490,11 @@
"key.offset" : 657
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "The action that users should specify to use this subcommand (e.g., `help`)."
+ }
+ ],
"key.doc.column" : 6,
"key.doc.declaration" : "var verb: String { get }",
"key.doc.file" : "Sources\/Commandant\/Command.swift",
@@ -5147,6 +5532,11 @@
"key.offset" : 683
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "A human-readable, high-level description of what this command is used for."
+ }
+ ],
"key.doc.column" : 6,
"key.doc.declaration" : "var function: String { get }",
"key.doc.file" : "Sources\/Commandant\/Command.swift",
@@ -5211,6 +5601,11 @@
],
"key.bodylength" : 102,
"key.bodyoffset" : 931,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Initializes the command to provide help from the given registry of commands."
+ }
+ ],
"key.doc.column" : 9,
"key.doc.comment" : "Initializes the command to provide help from the given registry of\ncommands.",
"key.doc.declaration" : "public init(registry: CommandRegistry, function: String? = nil)",
@@ -5251,6 +5646,11 @@
],
"key.bodylength" : 625,
"key.bodyoffset" : 1101,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Runs this subcommand with the given options."
+ }
+ ],
"key.doc.column" : 7,
"key.doc.declaration" : "func run(_ options: Options) -> Result<(), ClientError>",
"key.doc.file" : "Sources\/Commandant\/Command.swift",
@@ -5464,6 +5864,11 @@
],
"key.bodylength" : 99,
"key.bodyoffset" : 2100,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates this set of options in the given mode."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.declaration" : "static func evaluate(_ m: CommandMode) -> Result>",
"key.doc.discussion" : [
@@ -5524,6 +5929,11 @@
],
"key.bodylength" : 233,
"key.bodyoffset" : 1421,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Represents a record of options for a command, which can be parsed from a list of command-line arguments."
+ }
+ ],
"key.doc.column" : 17,
"key.doc.comment" : "Represents a record of options for a command, which can be parsed from\na list of command-line arguments.\n\nThis is most helpful when used in conjunction with the `Option` and `Switch`\ntypes, and `<*>` and `<|` combinators.\n\nExample:\n\n\tstruct LogOptions: OptionsProtocol {\n\t\tlet verbosity: Int\n\t\tlet outputFilename: String\n\t\tlet shouldDelete: Bool\n\t\tlet logName: String\n\n\t\tstatic func create(_ verbosity: Int) -> (String) -> (Bool) -> (String) -> LogOptions {\n\t\t\treturn { outputFilename in { shouldDelete in { logName in LogOptions(verbosity: verbosity, outputFilename: outputFilename, shouldDelete: shouldDelete, logName: logName) } } }\n\t\t}\n\n\t\tstatic func evaluate(_ m: CommandMode) -> Result> {\n\t\t\treturn create\n\t\t\t\t<*> m <| Option(key: \"verbose\", defaultValue: 0, usage: \"the verbosity level with which to read the logs\")\n\t\t\t\t<*> m <| Option(key: \"outputFilename\", defaultValue: \"\", usage: \"a file to print output to, instead of stdout\")\n\t\t\t\t<*> m <| Switch(flag: \"d\", key: \"delete\", usage: \"delete the logs when finished\")\n\t\t\t\t<*> m <| Argument(usage: \"the log to read\")\n\t\t}\n\t}",
"key.doc.declaration" : "public protocol OptionsProtocol",
@@ -5579,6 +5989,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.public",
"key.annotated_decl" : "static func evaluate(_ m: CommandMode<\/Type>) -> Result<\/Type><Self<\/Type>, CommandantError<\/Type><ClientError<\/Type>>><\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates this set of options in the given mode."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.comment" : "Evaluates this set of options in the given mode.\n\nReturns the parsed options or a `UsageError`.",
"key.doc.declaration" : "static func evaluate(_ m: CommandMode) -> Result>",
@@ -5629,6 +6044,11 @@
],
"key.bodylength" : 154,
"key.bodyoffset" : 1765,
+ "key.doc.abstract" : [
+ {
+ "Para" : "An `OptionsProtocol` that has no options."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "An `OptionsProtocol` that has no options.",
"key.doc.declaration" : "public struct NoOptions : OptionsProtocol where ClientError : Error",
@@ -5731,6 +6151,11 @@
],
"key.bodylength" : 33,
"key.bodyoffset" : 1884,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates this set of options in the given mode."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.declaration" : "static func evaluate(_ m: CommandMode) -> Result>",
"key.doc.discussion" : [
@@ -5783,6 +6208,11 @@
],
"key.bodylength" : 786,
"key.bodyoffset" : 2013,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes an option that can be provided on the command line."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Describes an option that can be provided on the command line.",
"key.doc.declaration" : "public struct Option",
@@ -5832,6 +6262,11 @@
"key.offset" : 2132
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "The key that controls this option. For example, a key of `verbose` would be used for a `--verbose` option."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "The key that controls this option. For example, a key of `verbose` would\nbe used for a `--verbose` option.",
"key.doc.declaration" : "public let key: String",
@@ -5867,6 +6302,11 @@
"key.offset" : 2303
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "The default value for this option. This is the value that will be used if the option is never explicitly specified on the command line."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "The default value for this option. This is the value that will be used\nif the option is never explicitly specified on the command line.",
"key.doc.declaration" : "public let defaultValue: T",
@@ -5902,12 +6342,17 @@
"key.offset" : 2637
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "A human-readable string describing the purpose of this option. This will be shown in help messages."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "A human-readable string describing the purpose of this option. This will\nbe shown in help messages.\n\nFor boolean operations, this should describe the effect of _not_ using\nthe default value (i.e., what will happen if you disable\/enable the flag\ndifferently from the default).",
"key.doc.declaration" : "public let usage: String",
"key.doc.discussion" : [
{
- "Para" : "For boolean operations, this should describe the effect of using the default value (i.e., what will happen if you disable\/enable the flag differently from the default)."
+ "Para" : "For boolean operations, this should describe the effect of _not_ using the default value (i.e., what will happen if you disable\/enable the flag differently from the default)."
}
],
"key.doc.file" : "Sources\/Commandant\/Option.swift",
@@ -5972,6 +6417,11 @@
"key.annotated_decl" : "public struct Option<T><\/Declaration>",
"key.bodylength" : 58,
"key.bodyoffset" : 2845,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes an option that can be provided on the command line."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.declaration" : "public struct Option",
"key.doc.file" : "Sources\/Commandant\/Option.swift",
@@ -6015,6 +6465,11 @@
],
"key.bodylength" : 22,
"key.bodyoffset" : 2879,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A textual representation of this instance."
+ }
+ ],
"key.doc.declaration" : "var description: String { get }",
"key.doc.discussion" : [
{
@@ -6075,6 +6530,11 @@
],
"key.bodylength" : 22,
"key.bodyoffset" : 4545,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Applies `f` to the value in the given result."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "Applies `f` to the value in the given result.\n\nIn the context of command-line option parsing, this is used to chain\ntogether the parsing of multiple arguments. See OptionsProtocol for an example.",
"key.doc.declaration" : "public func <*> (f: (T) -> U, value: Result>) -> Result>",
@@ -6175,6 +6635,11 @@
],
"key.bodylength" : 346,
"key.bodyoffset" : 4978,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Applies the function in `f` to the value in the given result."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "Applies the function in `f` to the value in the given result.\n\nIn the context of command-line option parsing, this is used to chain\ntogether the parsing of multiple arguments. See OptionsProtocol for an example.",
"key.doc.declaration" : "public func <*> (f: Result<((T) -> U), CommandantError>, value: Result>) -> Result>",
@@ -6268,6 +6733,11 @@
"key.annotated_decl" : "public enum CommandMode<\/Declaration>",
"key.bodylength" : 4309,
"key.bodyoffset" : 5350,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes the āmodeā in which a command should run."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.declaration" : "public enum CommandMode",
"key.doc.file" : "Sources\/Commandant\/Command.swift",
@@ -6299,6 +6769,11 @@
],
"key.bodylength" : 230,
"key.bodyoffset" : 5677,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates the given option in the given mode."
+ }
+ ],
"key.doc.column" : 21,
"key.doc.comment" : "Evaluates the given option in the given mode.\n\nIf parsing command line arguments, and no value was specified on the command\nline, the option's `defaultValue` is used.",
"key.doc.declaration" : "public static func <| (mode: CommandMode, option: Option) -> Result> where T : ArgumentProtocol",
@@ -6429,6 +6904,11 @@
],
"key.bodylength" : 852,
"key.bodyoffset" : 6216,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates the given option in the given mode."
+ }
+ ],
"key.doc.column" : 21,
"key.doc.comment" : "Evaluates the given option in the given mode.\n\nIf parsing command line arguments, and no value was specified on the command\nline, `nil` is used.",
"key.doc.declaration" : "public static func <| (mode: CommandMode, option: Option) -> Result> where T : ArgumentProtocol",
@@ -6559,6 +7039,11 @@
],
"key.bodylength" : 232,
"key.bodyoffset" : 7401,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates the given option in the given mode."
+ }
+ ],
"key.doc.column" : 21,
"key.doc.comment" : "Evaluates the given option in the given mode.\n\nIf parsing command line arguments, and no value was specified on the command\nline, the option's `defaultValue` is used.",
"key.doc.declaration" : "public static func <| (mode: CommandMode, option: Option<[T]>) -> Result<[T], CommandantError> where T : ArgumentProtocol",
@@ -6689,6 +7174,11 @@
],
"key.bodylength" : 1117,
"key.bodyoffset" : 7946,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates the given option in the given mode."
+ }
+ ],
"key.doc.column" : 21,
"key.doc.comment" : "Evaluates the given option in the given mode.\n\nIf parsing command line arguments, and no value was specified on the command\nline, `nil` is used.",
"key.doc.declaration" : "public static func <| (mode: CommandMode, option: Option<[T]?>) -> Result<[T]?, CommandantError> where T : ArgumentProtocol",
@@ -6819,6 +7309,11 @@
],
"key.bodylength" : 272,
"key.bodyoffset" : 9385,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates the given boolean option in the given mode."
+ }
+ ],
"key.doc.column" : 21,
"key.doc.comment" : "Evaluates the given boolean option in the given mode.\n\nIf parsing command line arguments, and no value was specified on the command\nline, the option's `defaultValue` is used.",
"key.doc.declaration" : "public static func <| (mode: CommandMode, option: Option) -> Result>",
@@ -6916,6 +7411,11 @@
],
"key.bodylength" : 348,
"key.bodyoffset" : 82,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A poor manās ordered set."
+ }
+ ],
"key.doc.column" : 17,
"key.doc.comment" : "A poor man's ordered set.",
"key.doc.declaration" : "internal struct OrderedSet : Equatable where T : Hashable",
@@ -7101,6 +7601,11 @@
"key.annotated_decl" : "internal struct OrderedSet<T> : Equatable<\/Type> where T : Hashable<\/Type><\/Declaration>",
"key.bodylength" : 331,
"key.bodyoffset" : 467,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A poor manās ordered set."
+ }
+ ],
"key.doc.column" : 17,
"key.doc.declaration" : "internal struct OrderedSet : Equatable where T : Hashable",
"key.doc.file" : "Sources\/Commandant\/OrderedSet.swift",
@@ -7137,6 +7642,16 @@
"key.annotated_decl" : "subscript(position: Int<\/Type>) -> T<\/Type> { get }<\/Declaration>",
"key.bodylength" : 28,
"key.bodyoffset" : 500,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Accesses the element at the specified position."
+ }
+ ],
+ "key.doc.complexity" : [
+ {
+ "Para" : "O(1)"
+ }
+ ],
"key.doc.declaration" : "subscript(position: Self.Index) -> Self.Element { get }",
"key.doc.discussion" : [
{
@@ -7193,10 +7708,20 @@
"key.annotated_decl" : "var count: Int<\/Type> { get }<\/Declaration>",
"key.bodylength" : 24,
"key.bodyoffset" : 548,
+ "key.doc.abstract" : [
+ {
+ "Para" : "The number of elements in the collection."
+ }
+ ],
+ "key.doc.complexity" : [
+ {
+ "Para" : "O(1) if the collection conforms to `RandomAccessCollection`; otherwise, O(_n_), where _n_ is the length of the collection."
+ }
+ ],
"key.doc.declaration" : "var count: Int { get }",
"key.doc.discussion" : [
{
- "Para" : "To check whether a collection is empty, use its `isEmpty` property instead of comparing `count` to zero. Unless the collection guarantees random-access performance, calculating `count` can be an O() operation."
+ "Para" : "To check whether a collection is empty, use its `isEmpty` property instead of comparing `count` to zero. Unless the collection guarantees random-access performance, calculating `count` can be an O(_n_) operation."
},
{
"Complexity" : ""
@@ -7230,6 +7755,16 @@
"key.annotated_decl" : "var isEmpty: Bool<\/Type> { get }<\/Declaration>",
"key.bodylength" : 26,
"key.bodyoffset" : 595,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A Boolean value indicating whether the collection is empty."
+ }
+ ],
+ "key.doc.complexity" : [
+ {
+ "Para" : "O(1)"
+ }
+ ],
"key.doc.declaration" : "var isEmpty: Bool { get }",
"key.doc.discussion" : [
{
@@ -7270,6 +7805,11 @@
"key.annotated_decl" : "var startIndex: Int<\/Type> { get }<\/Declaration>",
"key.bodylength" : 29,
"key.bodyoffset" : 646,
+ "key.doc.abstract" : [
+ {
+ "Para" : "The position of the first element in a nonempty collection."
+ }
+ ],
"key.doc.declaration" : "var startIndex: Self.Index { get }",
"key.doc.discussion" : [
{
@@ -7304,6 +7844,11 @@
"key.annotated_decl" : "var endIndex: Int<\/Type> { get }<\/Declaration>",
"key.bodylength" : 27,
"key.bodyoffset" : 698,
+ "key.doc.abstract" : [
+ {
+ "Para" : "The collectionās āpast the endā positionāthat is, the position one greater than the last valid subscript argument."
+ }
+ ],
"key.doc.declaration" : "var endIndex: Self.Index { get }",
"key.doc.discussion" : [
{
@@ -7344,6 +7889,11 @@
"key.annotated_decl" : "func index(after i: Int<\/Type>) -> Int<\/Type><\/Declaration>",
"key.bodylength" : 34,
"key.bodyoffset" : 762,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Returns the position immediately after the given index."
+ }
+ ],
"key.doc.declaration" : "func index(after i: Self.Index) -> Self.Index",
"key.doc.discussion" : [
{
@@ -7416,6 +7966,11 @@
],
"key.bodylength" : 244,
"key.bodyoffset" : 175,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A value that represents either a success or a failure, including an associated value in each case."
+ }
+ ],
"key.doc.declaration" : "enum Result where Failure : Error",
"key.doc.full_as_xml" : "Result<\/Name>s:s6ResultO<\/USR>enum Result<Success, Failure> where Failure : Error<\/Declaration>A value that represents either a success or a failure, including an associated value in each case.<\/Para><\/Abstract><\/CommentParts><\/Other>",
"key.doc.name" : "Result",
@@ -7501,6 +8056,11 @@
],
"key.bodylength" : 724,
"key.bodyoffset" : 397,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes a parameterless command line flag that defaults to false and can only be switched on. Canonical examples include `--force` and `--recurse`."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Describes a parameterless command line flag that defaults to false and can only\nbe switched on. Canonical examples include `--force` and `--recurse`.\n\nFor a boolean toggle that can be enabled and disabled use `Option`.",
"key.doc.declaration" : "public struct Switch",
@@ -7538,6 +8098,11 @@
"key.offset" : 515
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "The key that enables this switch. For example, a key of `verbose` would be used for a `--verbose` option."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "The key that enables this switch. For example, a key of `verbose` would be\nused for a `--verbose` option.",
"key.doc.declaration" : "public let key: String",
@@ -7573,6 +8138,11 @@
"key.offset" : 828
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "Optional single letter flag that enables this switch. For example, `-v` would be used as a shorthand for `--verbose`."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "Optional single letter flag that enables this switch. For example, `-v` would\nbe used as a shorthand for `--verbose`.\n\nMultiple flags can be grouped together as a single argument and will split\nwhen parsing (e.g. `rm -rf` treats 'r' and 'f' as inidividual flags).",
"key.doc.declaration" : "public let flag: Character?",
@@ -7613,6 +8183,11 @@
"key.offset" : 968
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "A human-readable string describing the purpose of this option. This will be shown in help messages."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "A human-readable string describing the purpose of this option. This will\nbe shown in help messages.",
"key.doc.declaration" : "public let usage: String",
@@ -7678,6 +8253,11 @@
"key.annotated_decl" : "public struct Switch<\/Declaration>",
"key.bodylength" : 140,
"key.bodyoffset" : 1167,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes a parameterless command line flag that defaults to false and can only be switched on. Canonical examples include `--force` and `--recurse`."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.declaration" : "public struct Switch",
"key.doc.discussion" : [
@@ -7726,6 +8306,11 @@
],
"key.bodylength" : 104,
"key.bodyoffset" : 1201,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A textual representation of this instance."
+ }
+ ],
"key.doc.declaration" : "var description: String { get }",
"key.doc.discussion" : [
{
@@ -7796,6 +8381,11 @@
"key.annotated_decl" : "public enum CommandMode<\/Declaration>",
"key.bodylength" : 650,
"key.bodyoffset" : 1355,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes the āmodeā in which a command should run."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.declaration" : "public enum CommandMode",
"key.doc.file" : "Sources\/Commandant\/Command.swift",
@@ -7827,6 +8417,11 @@
],
"key.bodylength" : 333,
"key.bodyoffset" : 1670,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates the given boolean switch in the given mode."
+ }
+ ],
"key.doc.column" : 21,
"key.doc.comment" : "Evaluates the given boolean switch in the given mode.\n\nIf parsing command line arguments, and no value was specified on the command\nline, the option's `defaultValue` is used.",
"key.doc.declaration" : "public static func <| (mode: CommandMode, option: Switch) -> Result>",
diff --git a/Tests/SourceKittenFrameworkTests/Fixtures/Commandant@swift-5.1.json b/Tests/SourceKittenFrameworkTests/Fixtures/Commandant@swift-5.1.json
index 35fd11e83..c634ae782 100644
--- a/Tests/SourceKittenFrameworkTests/Fixtures/Commandant@swift-5.1.json
+++ b/Tests/SourceKittenFrameworkTests/Fixtures/Commandant@swift-5.1.json
@@ -16,6 +16,11 @@
],
"key.bodylength" : 1029,
"key.bodyoffset" : 231,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes an argument that can be provided on the command line."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "Describes an argument that can be provided on the command line.",
"key.doc.declaration" : "public struct Argument",
@@ -65,6 +70,11 @@
"key.offset" : 443
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "The default value for this argument. This is the value that will be used if the argument is never explicitly specified on the command line."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "The default value for this argument. This is the value that will be used\nif the argument is never explicitly specified on the command line.\n\nIf this is nil, this argument is always required.",
"key.doc.declaration" : "public let defaultValue: T?",
@@ -105,6 +115,11 @@
"key.offset" : 585
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "A human-readable string describing the purpose of this argument. This will be shown in help messages."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "A human-readable string describing the purpose of this argument. This will\nbe shown in help messages.",
"key.doc.declaration" : "public let usage: String",
@@ -140,6 +155,11 @@
"key.offset" : 804
}
],
+ "key.doc.abstract" : [
+ {
+ "Para" : "A human-readable string that describes this argument as a paramater shown in the list of possible parameters in help messages (e.g. for āpathsā, the user would see )."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.comment" : "A human-readable string that describes this argument as a paramater shown\nin the list of possible parameters in help messages (e.g. for \"paths\", the\nuser would see ).",
"key.doc.declaration" : "public let usageParameter: String?",
@@ -268,6 +288,11 @@
"key.annotated_decl" : "public struct Argument<T><\/Declaration>",
"key.bodylength" : 251,
"key.bodyoffset" : 1283,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes an argument that can be provided on the command line."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.declaration" : "public struct Argument",
"key.doc.file" : "Sources\/Commandant\/Argument.swift",
@@ -299,6 +324,11 @@
],
"key.bodylength" : 62,
"key.bodyoffset" : 1470,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A string describing this argument as a parameter in help messages. This falls back to `\"\\(self)\"` if `usageParameter` is `nil`"
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "A string describing this argument as a parameter in help messages. This falls back\nto `\"\\(self)\"` if `usageParameter` is `nil`",
"key.doc.declaration" : "internal var usageParameterDescription: String { get }",
@@ -339,6 +369,11 @@
"key.annotated_decl" : "public struct Argument<T><\/Declaration>",
"key.bodylength" : 254,
"key.bodyoffset" : 1575,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes an argument that can be provided on the command line."
+ }
+ ],
"key.doc.column" : 15,
"key.doc.declaration" : "public struct Argument",
"key.doc.file" : "Sources\/Commandant\/Argument.swift",
@@ -370,6 +405,11 @@
],
"key.bodylength" : 65,
"key.bodyoffset" : 1762,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A string describing this argument as a parameter in help messages. This falls back to `\"\\(self)\"` if `usageParameter` is `nil`"
+ }
+ ],
"key.doc.column" : 15,
"key.doc.comment" : "A string describing this argument as a parameter in help messages. This falls back\nto `\"\\(self)\"` if `usageParameter` is `nil`",
"key.doc.declaration" : "internal var usageParameterDescription: String { get }",
@@ -418,6 +458,11 @@
"key.annotated_decl" : "public enum CommandMode<\/Declaration>",
"key.bodylength" : 1979,
"key.bodyoffset" : 1877,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Describes the āmodeā in which a command should run."
+ }
+ ],
"key.doc.column" : 13,
"key.doc.declaration" : "public enum CommandMode",
"key.doc.file" : "Sources\/Commandant\/Command.swift",
@@ -449,6 +494,11 @@
],
"key.bodylength" : 518,
"key.bodyoffset" : 2212,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates the given argument in the given mode."
+ }
+ ],
"key.doc.column" : 21,
"key.doc.comment" : "Evaluates the given argument in the given mode.\n\nIf parsing command line arguments, and no value was specified on the command\nline, the argument's `defaultValue` is used.",
"key.doc.declaration" : "public static func <| (mode: CommandMode, argument: Argument) -> Result> where T : Commandant.ArgumentProtocol",
@@ -562,6 +612,11 @@
],
"key.bodylength" : 778,
"key.bodyoffset" : 3076,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Evaluates the given argument list in the given mode."
+ }
+ ],
"key.doc.column" : 21,
"key.doc.comment" : "Evaluates the given argument list in the given mode.\n\nIf parsing command line arguments, and no value was specified on the command\nline, the argument's `defaultValue` is used.",
"key.doc.declaration" : "public static func <| (mode: CommandMode, argument: Argument<[T]>) -> Result<[T], CommandantError> where T : Commandant.ArgumentProtocol",
@@ -688,6 +743,11 @@
],
"key.bodylength" : 296,
"key.bodyoffset" : 266,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Represents an argument passed on the command line."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.comment" : "Represents an argument passed on the command line.",
"key.doc.declaration" : "private enum RawArgument : Equatable",
@@ -732,6 +792,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "case key(String<\/Type>)<\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "A key corresponding to an option (e.g., `verbose` for `--verbose`)."
+ }
+ ],
"key.doc.column" : 7,
"key.doc.comment" : "A key corresponding to an option (e.g., `verbose` for `--verbose`).",
"key.doc.declaration" : "",
@@ -769,6 +834,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "case value(String<\/Type>)<\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "A value, either associated with an option or passed as a positional argument."
+ }
+ ],
"key.doc.column" : 7,
"key.doc.comment" : "A value, either associated with an option or passed as a positional\nargument.",
"key.doc.declaration" : "",
@@ -806,6 +876,11 @@
{
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.annotated_decl" : "case flag(OrderedSet<\/Type><Character<\/Type>>)<\/Declaration>",
+ "key.doc.abstract" : [
+ {
+ "Para" : "One or more flag arguments (e.g ārā and āfā for `-rf`)"
+ }
+ ],
"key.doc.column" : 7,
"key.doc.comment" : "One or more flag arguments (e.g 'r' and 'f' for `-rf`)",
"key.doc.declaration" : "",
@@ -843,6 +918,11 @@
"key.annotated_decl" : "private enum RawArgument : Equatable<\/Type><\/Declaration>",
"key.bodylength" : 214,
"key.bodyoffset" : 613,
+ "key.doc.abstract" : [
+ {
+ "Para" : "Represents an argument passed on the command line."
+ }
+ ],
"key.doc.column" : 14,
"key.doc.declaration" : "private enum RawArgument : Equatable",
"key.doc.file" : "Sources\/Commandant\/ArgumentParser.swift",
@@ -886,6 +966,11 @@
],
"key.bodylength" : 173,
"key.bodyoffset" : 652,
+ "key.doc.abstract" : [
+ {
+ "Para" : "A textual representation of this instance."
+ }
+ ],
"key.doc.declaration" : "var description: String { get }",
"key.doc.discussion" : [
{
@@ -903,6 +988,11 @@
],
"key.doc.full_as_xml" : "description<\/Name>s:s23CustomStringConvertibleP11descriptionSSvp<\/USR>var description: String { get }<\/Declaration>A textual representation of this instance.<\/Para><\/Abstract>Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the String(describing:)<\/codeVoice> initializer. This initializer works with any type, and uses the custom description<\/codeVoice> property for types that conform to CustomStringConvertible<\/codeVoice>:<\/Para><\/zCodeLineNumbered><\/zCodeLineNumbered><\/zCodeLineNumbered><\/zCodeLineNumbered><\/zCodeLineNumbered><\/zCodeLineNumbered><\/zCodeLineNumbered><\/zCodeLineNumbered><\/zCodeLineNumbered><\/zCodeLineNumbered><\/zCodeLineNumbered><\/zCodeLineNumbered><\/zCodeLineNumbered><\/CodeListing>The conversion of p<\/codeVoice> to a string in the assignment to s<\/codeVoice> uses the Point<\/codeVoice> typeās