Skip to content

Commit

Permalink
Make a command’s verbose description available
Browse files Browse the repository at this point in the history
Making it available through CustomDebugStringConvertible’s debugDescription
  • Loading branch information
hartbit committed Aug 11, 2018
1 parent 110d3c1 commit 0e1710c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion products/llbuildSwift/BuildSystemBindings.swift
Expand Up @@ -157,7 +157,7 @@ public struct Diagnostic {
}

/// Handle for a command as invoked by the low-level BuildSystem.
public struct Command: Hashable {
public struct Command: Hashable, CustomStringConvertible, CustomDebugStringConvertible {
fileprivate let handle: OpaquePointer?

fileprivate init(_ handle: OpaquePointer?) {
Expand Down Expand Up @@ -188,6 +188,19 @@ public struct Command: Hashable {
return String(cString: name)
}

/// The verbose description provided by the command.
public var verboseDescription: String {
let name = llb_buildsystem_command_get_verbose_description(handle)!
defer { free(name) }

return String(cString: name)
}

/// The debug description provides the verbose description.
public var debugDescription: String {
return verboseDescription
}

public var hashValue: Int {
return handle!.hashValue
}
Expand Down

0 comments on commit 0e1710c

Please sign in to comment.