{"action":"created","comment":{"url":"https://api.github.com/repos/Carthage/Carthage/pulls/comments/24192393","id":24192393,"diff_hunk":"@@ -0,0 +1,103 @@\n+//\n+//  Formatting.swift\n+//  Carthage\n+//\n+//  Created by J.D. Healy on 1/29/15.\n+//  Copyright (c) 2015 Carthage. All rights reserved.\n+//\n+\n+import Commandant\n+import Foundation\n+import LlamaKit\n+import PrettyColors\n+import ReactiveCocoa\n+\n+/// Wraps or passes through a string.\n+func wrap(colorful: Bool)(wrap: Color.Wrap)(string: String) -> String {\n+\treturn colorful ? wrap.wrap(string) : string\n+}\n+\n+/// Information about the possible parent terminal.\n+internal struct Terminal {\n+\tstatic var term: String? {\n+\t\treturn getEnvironmentVariable(\"TERM\").value()\n+\t}\n+\tstatic var isDumb: Bool {\n+\t\treturn (Terminal.term?.lowercaseString as NSString?)?.isEqualToString(\"dumb\") ?? false\n+\t}\n+\tstatic var isTTY: Bool {\n+\t\treturn isatty(STDOUT_FILENO) == 1\n+\t}\n+}\n+\n+public enum ColorArgument: String, ArgumentType, Printable {\n+\tcase Auto = \"auto\"\n+\tcase Never = \"never\"\n+\tcase Always = \"always\"\n+\t\n+\t/// Whether to color and format.\n+\tpublic var isColorful: Bool {\n+\t\tswitch self {\n+\t\tcase .Always:\n+\t\t\treturn true\n+\t\tcase .Never:\n+\t\t\treturn false\n+\t\tcase .Auto:\n+\t\t\treturn Terminal.isTTY && !Terminal.isDumb\n+\t\t}\n+\t}\n+\t\n+\tpublic var description: String {\n+\t\treturn self.rawValue\n+\t}\n+\t\n+\tpublic static let name = \"color\"\n+\t\n+\tpublic static func fromString(string: String) -> ColorArgument? {\n+\t\treturn self(rawValue: string.lowercaseString)\n+\t}\n+\t\n+}\n+\n+public struct ColorOptions: OptionsType {\n+\tlet argument: ColorArgument\n+\tlet formatting: Formatting\n+\t\n+\tstruct Formatting {\n+\t\tlet colorful: Bool\n+\t\t\n+\t\t/// Wraps or passes through a string.\n+\t\ttypealias Wrap = (string: String) -> String\n+\t\t\n+\t\tinit(_ colorful: Bool) {\n+\t\t\tself.colorful    = colorful\n+\t\t\tself.bulletin    = wrap(colorful)(wrap: Color.Wrap(foreground: .Blue, style: .Bold))","path":"Source/carthage/Formatting.swift","position":74,"original_position":74,"commit_id":"22d5892fa9a485aa2d0c68e1bf879ba439608260","original_commit_id":"22d5892fa9a485aa2d0c68e1bf879ba439608260","user":{"login":"jspahrsummers","id":432536,"avatar_url":"https://avatars.githubusercontent.com/u/432536?v=3","gravatar_id":"","url":"https://api.github.com/users/jspahrsummers","html_url":"https://github.com/jspahrsummers","followers_url":"https://api.github.com/users/jspahrsummers/followers","following_url":"https://api.github.com/users/jspahrsummers/following{/other_user}","gists_url":"https://api.github.com/users/jspahrsummers/gists{/gist_id}","starred_url":"https://api.github.com/users/jspahrsummers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jspahrsummers/subscriptions","organizations_url":"https://api.github.com/users/jspahrsummers/orgs","repos_url":"https://api.github.com/users/jspahrsummers/repos","events_url":"https://api.github.com/users/jspahrsummers/events{/privacy}","received_events_url":"https://api.github.com/users/jspahrsummers/received_events","type":"User","site_admin":true},"body":"The use of `self` on most of these lines seems to be unnecessary.","created_at":"2015-02-05T19:41:58Z","updated_at":"2015-02-05T19:41:58Z","html_url":"https://github.com/Carthage/Carthage/pull/292#discussion_r24192393","pull_request_url":"https://api.github.com/repos/Carthage/Carthage/pulls/292","_links":{"self":{"href":"https://api.github.com/repos/Carthage/Carthage/pulls/comments/24192393"},"html":{"href":"https://github.com/Carthage/Carthage/pull/292#discussion_r24192393"},"pull_request":{"href":"https://api.github.com/repos/Carthage/Carthage/pulls/292"}}},"pull_request":{"url":"https://api.github.com/repos/Carthage/Carthage/pulls/292","id":28219842,"html_url":"https://github.com/Carthage/Carthage/pull/292","diff_url":"https://github.com/Carthage/Carthage/pull/292.diff","patch_url":"https://github.com/Carthage/Carthage/pull/292.patch","issue_url":"https://api.github.com/repos/Carthage/Carthage/issues/292","number":292,"state":"open","locked":false,"title":"PrettyColors — Take advantage of the terminal","user":{"login":"jdhealy","id":782837,"avatar_url":"https://avatars.githubusercontent.com/u/782837?v=3","gravatar_id":"","url":"https://api.github.com/users/jdhealy","html_url":"https://github.com/jdhealy","followers_url":"https://api.github.com/users/jdhealy/followers","following_url":"https://api.github.com/users/jdhealy/following{/other_user}","gists_url":"https://api.github.com/users/jdhealy/gists{/gist_id}","starred_url":"https://api.github.com/users/jdhealy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdhealy/subscriptions","organizations_url":"https://api.github.com/users/jdhealy/orgs","repos_url":"https://api.github.com/users/jdhealy/repos","events_url":"https://api.github.com/users/jdhealy/events{/privacy}","received_events_url":"https://api.github.com/users/jdhealy/received_events","type":"User","site_admin":false},"body":"_Resolves #121_\r\n\r\nAdds colors and formatting to most `carthage.println`s. Imports [jdhealy/PrettyColors](//github.com/jdhealy/PrettyColors).\r\n\r\nBasically just the bare minimum of commits to Carthage to allow for flexibility based off your feedback.\r\n\r\nI based most of the color and formatting choices off [homebrew](//github.com/homebrew/homebrew).\r\n\r\nOutput looks like this in iTerm 2 with custom pastel-ish colors:\r\n![screen shot 2015-01-12 at 1 00 04 pm](https://cloud.githubusercontent.com/assets/782837/5944325/132421c6-a6f4-11e4-8a46-414e479d8637.png)\r\n\r\nOutput looks like this in Terminal.app using basic colors:\r\n![screen shot 2015-01-14 at 6 35 44 pm](https://cloud.githubusercontent.com/assets/782837/5944351/4975b384-a6f4-11e4-82b4-dc31359c01c4.png)\r\n\r\n## Feedback\r\n- Color and formatting choices\r\n  - Any preferences on colors or formatting?\r\n  - I've styled the output so far with [widely-supported styles](https://github.com/jdhealy/PrettyColors/wiki/Terminal-Support) _(bold and underlined)_ and [nearly-universal colors](https://github.com/jdhealy/PrettyColors/blob/development/Source/Color/Named.swift). \r\n\r\n- Command line arguments and environment variables\r\n  - Should we check any environment variables? `$TERM`?\r\n  - `--no-colors` flag?\r\n\r\n- PrettyColors as a framework of CarthageKit\r\n  - I embedded PrettyColors inside of CarthageKit like all the other dependencies, but the library is actually only used in the `carthage` target. Should it be taken out of CarthageKit?\r\n\r\n- Lastly, I'd really welcome feedback on the library. It's pinned in the Cartfile at [`edf8291df2`](https://github.com/jdhealy/PrettyColors/commit/edf8291df2f524ed62dcfa60227b988535ccf6eb), which is essentially `v1.0.0-rc1`. So, please raise any concerns or observations! :smiley:","created_at":"2015-01-28T19:03:43Z","updated_at":"2015-02-05T19:41:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8a76c75a3e3469c8c09458657f71a17f67c15dbd","assignee":{"login":"jspahrsummers","id":432536,"avatar_url":"https://avatars.githubusercontent.com/u/432536?v=3","gravatar_id":"","url":"https://api.github.com/users/jspahrsummers","html_url":"https://github.com/jspahrsummers","followers_url":"https://api.github.com/users/jspahrsummers/followers","following_url":"https://api.github.com/users/jspahrsummers/following{/other_user}","gists_url":"https://api.github.com/users/jspahrsummers/gists{/gist_id}","starred_url":"https://api.github.com/users/jspahrsummers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jspahrsummers/subscriptions","organizations_url":"https://api.github.com/users/jspahrsummers/orgs","repos_url":"https://api.github.com/users/jspahrsummers/repos","events_url":"https://api.github.com/users/jspahrsummers/events{/privacy}","received_events_url":"https://api.github.com/users/jspahrsummers/received_events","type":"User","site_admin":true},"milestone":null,"commits_url":"https://api.github.com/repos/Carthage/Carthage/pulls/292/commits","review_comments_url":"https://api.github.com/repos/Carthage/Carthage/pulls/292/comments","review_comment_url":"https://api.github.com/repos/Carthage/Carthage/pulls/comments/{number}","comments_url":"https://api.github.com/repos/Carthage/Carthage/issues/292/comments","statuses_url":"https://api.github.com/repos/Carthage/Carthage/statuses/22d5892fa9a485aa2d0c68e1bf879ba439608260","head":{"label":"jdhealy:pretty-colors","ref":"pretty-colors","sha":"22d5892fa9a485aa2d0c68e1bf879ba439608260","user":{"login":"jdhealy","id":782837,"avatar_url":"https://avatars.githubusercontent.com/u/782837?v=3","gravatar_id":"","url":"https://api.github.com/users/jdhealy","html_url":"https://github.com/jdhealy","followers_url":"https://api.github.com/users/jdhealy/followers","following_url":"https://api.github.com/users/jdhealy/following{/other_user}","gists_url":"https://api.github.com/users/jdhealy/gists{/gist_id}","starred_url":"https://api.github.com/users/jdhealy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdhealy/subscriptions","organizations_url":"https://api.github.com/users/jdhealy/orgs","repos_url":"https://api.github.com/users/jdhealy/repos","events_url":"https://api.github.com/users/jdhealy/events{/privacy}","received_events_url":"https://api.github.com/users/jdhealy/received_events","type":"User","site_admin":false},"repo":{"id":27882913,"name":"Carthage","full_name":"jdhealy/Carthage","owner":{"login":"jdhealy","id":782837,"avatar_url":"https://avatars.githubusercontent.com/u/782837?v=3","gravatar_id":"","url":"https://api.github.com/users/jdhealy","html_url":"https://github.com/jdhealy","followers_url":"https://api.github.com/users/jdhealy/followers","following_url":"https://api.github.com/users/jdhealy/following{/other_user}","gists_url":"https://api.github.com/users/jdhealy/gists{/gist_id}","starred_url":"https://api.github.com/users/jdhealy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdhealy/subscriptions","organizations_url":"https://api.github.com/users/jdhealy/orgs","repos_url":"https://api.github.com/users/jdhealy/repos","events_url":"https://api.github.com/users/jdhealy/events{/privacy}","received_events_url":"https://api.github.com/users/jdhealy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jdhealy/Carthage","description":"A simple, decentralized dependency manager for Cocoa","fork":true,"url":"https://api.github.com/repos/jdhealy/Carthage","forks_url":"https://api.github.com/repos/jdhealy/Carthage/forks","keys_url":"https://api.github.com/repos/jdhealy/Carthage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdhealy/Carthage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdhealy/Carthage/teams","hooks_url":"https://api.github.com/repos/jdhealy/Carthage/hooks","issue_events_url":"https://api.github.com/repos/jdhealy/Carthage/issues/events{/number}","events_url":"https://api.github.com/repos/jdhealy/Carthage/events","assignees_url":"https://api.github.com/repos/jdhealy/Carthage/assignees{/user}","branches_url":"https://api.github.com/repos/jdhealy/Carthage/branches{/branch}","tags_url":"https://api.github.com/repos/jdhealy/Carthage/tags","blobs_url":"https://api.github.com/repos/jdhealy/Carthage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdhealy/Carthage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdhealy/Carthage/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdhealy/Carthage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdhealy/Carthage/statuses/{sha}","languages_url":"https://api.github.com/repos/jdhealy/Carthage/languages","stargazers_url":"https://api.github.com/repos/jdhealy/Carthage/stargazers","contributors_url":"https://api.github.com/repos/jdhealy/Carthage/contributors","subscribers_url":"https://api.github.com/repos/jdhealy/Carthage/subscribers","subscription_url":"https://api.github.com/repos/jdhealy/Carthage/subscription","commits_url":"https://api.github.com/repos/jdhealy/Carthage/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdhealy/Carthage/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdhealy/Carthage/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdhealy/Carthage/issues/comments/{number}","contents_url":"https://api.github.com/repos/jdhealy/Carthage/contents/{+path}","compare_url":"https://api.github.com/repos/jdhealy/Carthage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdhealy/Carthage/merges","archive_url":"https://api.github.com/repos/jdhealy/Carthage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdhealy/Carthage/downloads","issues_url":"https://api.github.com/repos/jdhealy/Carthage/issues{/number}","pulls_url":"https://api.github.com/repos/jdhealy/Carthage/pulls{/number}","milestones_url":"https://api.github.com/repos/jdhealy/Carthage/milestones{/number}","notifications_url":"https://api.github.com/repos/jdhealy/Carthage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdhealy/Carthage/labels{/name}","releases_url":"https://api.github.com/repos/jdhealy/Carthage/releases{/id}","created_at":"2014-12-11T17:23:01Z","updated_at":"2014-12-13T02:43:44Z","pushed_at":"2015-02-04T16:16:07Z","git_url":"git://github.com/jdhealy/Carthage.git","ssh_url":"git@github.com:jdhealy/Carthage.git","clone_url":"https://github.com/jdhealy/Carthage.git","svn_url":"https://github.com/jdhealy/Carthage","homepage":"","size":6215,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Carthage:0.6-development","ref":"0.6-development","sha":"2bf387bdefc53652fcfbb9c6fd39d3dbcec8f30b","user":{"login":"Carthage","id":9146792,"avatar_url":"https://avatars.githubusercontent.com/u/9146792?v=3","gravatar_id":"","url":"https://api.github.com/users/Carthage","html_url":"https://github.com/Carthage","followers_url":"https://api.github.com/users/Carthage/followers","following_url":"https://api.github.com/users/Carthage/following{/other_user}","gists_url":"https://api.github.com/users/Carthage/gists{/gist_id}","starred_url":"https://api.github.com/users/Carthage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Carthage/subscriptions","organizations_url":"https://api.github.com/users/Carthage/orgs","repos_url":"https://api.github.com/users/Carthage/repos","events_url":"https://api.github.com/users/Carthage/events{/privacy}","received_events_url":"https://api.github.com/users/Carthage/received_events","type":"Organization","site_admin":false},"repo":{"id":25050844,"name":"Carthage","full_name":"Carthage/Carthage","owner":{"login":"Carthage","id":9146792,"avatar_url":"https://avatars.githubusercontent.com/u/9146792?v=3","gravatar_id":"","url":"https://api.github.com/users/Carthage","html_url":"https://github.com/Carthage","followers_url":"https://api.github.com/users/Carthage/followers","following_url":"https://api.github.com/users/Carthage/following{/other_user}","gists_url":"https://api.github.com/users/Carthage/gists{/gist_id}","starred_url":"https://api.github.com/users/Carthage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Carthage/subscriptions","organizations_url":"https://api.github.com/users/Carthage/orgs","repos_url":"https://api.github.com/users/Carthage/repos","events_url":"https://api.github.com/users/Carthage/events{/privacy}","received_events_url":"https://api.github.com/users/Carthage/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Carthage/Carthage","description":"A simple, decentralized dependency manager for Cocoa","fork":false,"url":"https://api.github.com/repos/Carthage/Carthage","forks_url":"https://api.github.com/repos/Carthage/Carthage/forks","keys_url":"https://api.github.com/repos/Carthage/Carthage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Carthage/Carthage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Carthage/Carthage/teams","hooks_url":"https://api.github.com/repos/Carthage/Carthage/hooks","issue_events_url":"https://api.github.com/repos/Carthage/Carthage/issues/events{/number}","events_url":"https://api.github.com/repos/Carthage/Carthage/events","assignees_url":"https://api.github.com/repos/Carthage/Carthage/assignees{/user}","branches_url":"https://api.github.com/repos/Carthage/Carthage/branches{/branch}","tags_url":"https://api.github.com/repos/Carthage/Carthage/tags","blobs_url":"https://api.github.com/repos/Carthage/Carthage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Carthage/Carthage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Carthage/Carthage/git/refs{/sha}","trees_url":"https://api.github.com/repos/Carthage/Carthage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Carthage/Carthage/statuses/{sha}","languages_url":"https://api.github.com/repos/Carthage/Carthage/languages","stargazers_url":"https://api.github.com/repos/Carthage/Carthage/stargazers","contributors_url":"https://api.github.com/repos/Carthage/Carthage/contributors","subscribers_url":"https://api.github.com/repos/Carthage/Carthage/subscribers","subscription_url":"https://api.github.com/repos/Carthage/Carthage/subscription","commits_url":"https://api.github.com/repos/Carthage/Carthage/commits{/sha}","git_commits_url":"https://api.github.com/repos/Carthage/Carthage/git/commits{/sha}","comments_url":"https://api.github.com/repos/Carthage/Carthage/comments{/number}","issue_comment_url":"https://api.github.com/repos/Carthage/Carthage/issues/comments/{number}","contents_url":"https://api.github.com/repos/Carthage/Carthage/contents/{+path}","compare_url":"https://api.github.com/repos/Carthage/Carthage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Carthage/Carthage/merges","archive_url":"https://api.github.com/repos/Carthage/Carthage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Carthage/Carthage/downloads","issues_url":"https://api.github.com/repos/Carthage/Carthage/issues{/number}","pulls_url":"https://api.github.com/repos/Carthage/Carthage/pulls{/number}","milestones_url":"https://api.github.com/repos/Carthage/Carthage/milestones{/number}","notifications_url":"https://api.github.com/repos/Carthage/Carthage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Carthage/Carthage/labels{/name}","releases_url":"https://api.github.com/repos/Carthage/Carthage/releases{/id}","created_at":"2014-10-10T19:54:55Z","updated_at":"2015-02-05T15:50:27Z","pushed_at":"2015-02-04T18:02:40Z","git_url":"git://github.com/Carthage/Carthage.git","ssh_url":"git@github.com:Carthage/Carthage.git","clone_url":"https://github.com/Carthage/Carthage.git","svn_url":"https://github.com/Carthage/Carthage","homepage":"","size":8541,"stargazers_count":1829,"watchers_count":1829,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":50,"mirror_url":null,"open_issues_count":29,"forks":50,"open_issues":29,"watchers":1829,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Carthage/Carthage/pulls/292"},"html":{"href":"https://github.com/Carthage/Carthage/pull/292"},"issue":{"href":"https://api.github.com/repos/Carthage/Carthage/issues/292"},"comments":{"href":"https://api.github.com/repos/Carthage/Carthage/issues/292/comments"},"review_comments":{"href":"https://api.github.com/repos/Carthage/Carthage/pulls/292/comments"},"review_comment":{"href":"https://api.github.com/repos/Carthage/Carthage/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/Carthage/Carthage/pulls/292/commits"},"statuses":{"href":"https://api.github.com/repos/Carthage/Carthage/statuses/22d5892fa9a485aa2d0c68e1bf879ba439608260"}}}}