diff --git a/Sources/hpa/Internal/Discussion+playbook.swift b/Sources/hpa/Internal/Discussion+playbook.swift index 9b1c69a..fff9ed5 100644 --- a/Sources/hpa/Internal/Discussion+playbook.swift +++ b/Sources/hpa/Internal/Discussion+playbook.swift @@ -26,13 +26,32 @@ extension Array where Element == Example { )) return output } + + func addingPipeToOtherCommand(command: String) -> Self { + var output = self + output.append(( + label: "Piping output to other command.", + example: "\(command) --quiet | xargs open" + )) + return output + } } extension ExampleSection where Header == String, Label == String { - static func `default`(examples: [Example], usesPassingExtraOptions: Bool = true) -> some TextNode { + static func `default`( + examples: [Example], + usesPassingExtraOptions: Bool = true, + usesPipeToOtherCommand: Bool = true + ) -> some TextNode { var examples = examples - if usesPassingExtraOptions, let first = examples.first { - examples = examples.addingPassingOptions(command: first.example) + + if let first = examples.first { + if usesPassingExtraOptions { + examples = examples.addingPassingOptions(command: first.example) + } + if usesPipeToOtherCommand { + examples = examples.addingPipeToOtherCommand(command: first.example) + } } return Self(examples: examples) { "EXAMPLES:" diff --git a/Sources/hpa/UtilsCommands/CreateTemplateCommand.swift b/Sources/hpa/UtilsCommands/GenerateProjectTemplateCommand.swift similarity index 100% rename from Sources/hpa/UtilsCommands/CreateTemplateCommand.swift rename to Sources/hpa/UtilsCommands/GenerateProjectTemplateCommand.swift