func zshCompletionString()

in Sources/ArgumentParser/Completions/ZshCompletionsGenerator.swift [134:163]


  func zshCompletionString(_ commands: [ParsableCommand.Type]) -> String? {
    guard help.shouldDisplay else { return nil }
    
    var inputs: String
    switch update {
    case .unary:
      inputs = ":\(valueName):\(zshActionString(commands))"
    case .nullary:
      inputs = ""
    }

    let line: String
    switch names.count {
    case 0:
      line = ""
    case 1:
      line = """
      \(names[0].synopsisString)\(zshCompletionAbstract)
      """
    default:
      let synopses = names.map { $0.synopsisString }
      line = """
      (\(synopses.joined(separator: " ")))'\
      {\(synopses.joined(separator: ","))}\
      '\(zshCompletionAbstract)
      """
    }
    
    return "'\(line)\(inputs)'"
  }