@@ -4,6 +4,7 @@ import Foundation
4
4
import Result
5
5
import ReactiveSwift
6
6
import Curry
7
+ import PrettyColors
7
8
8
9
/// Type that encapsulates the configuration and evaluation of the `outdated` subcommand.
9
10
public struct OutdatedCommand : CommandProtocol {
@@ -54,13 +55,40 @@ public struct OutdatedCommand: CommandProtocol {
54
55
55
56
if !outdatedDependencies. isEmpty {
56
57
carthage. println ( formatting. path ( " The following dependencies are outdated: " ) )
58
+
57
59
for (project, current, updated, latest) in outdatedDependencies {
60
+ let versionColor : Color . Named . Color
61
+ switch ( current, updated, latest) {
62
+ case ( _, updated, latest) where updated == latest:
63
+ // Update available and applicable
64
+ versionColor = . green
65
+ case ( current, updated, latest) where current != updated && updated != latest:
66
+ // Update availabe and applicable, but not to the latest version due to version lock
67
+ versionColor = . yellow
68
+ case ( current, updated, latest) where current == updated:
69
+ // Update available, but not applicable due to version lock
70
+ versionColor = . red
71
+ default :
72
+ versionColor = . white
73
+ }
74
+
58
75
if options. outputXcodeWarnings {
59
76
carthage. println ( " warning: \( formatting. projectName ( project. name) ) is out of date ( \( current) -> \( updated) ) (Latest: \( latest) ) " )
60
77
} else {
61
- carthage. println ( formatting. projectName ( project. name) + " \( current) -> \( updated) (Latest: \( latest) ) " )
78
+ let versionSummary = formatting. colored ( current. description, color: versionColor)
79
+ + " -> " + formatting. colored ( updated. description, color: versionColor)
80
+ + " (Latest: \( latest) ) "
81
+ carthage. println ( formatting. projectName ( project. name) + " " + versionSummary)
62
82
}
63
83
}
84
+
85
+ if options. colorOptions. formatting. isColorful {
86
+ carthage. println ( formatting. path ( " The color indicates what happens when you run `carthage update` " ) )
87
+ carthage. println ( formatting. colored ( " <green> " , color: . green) + " \t \t - Will be updated to the newest version " )
88
+ carthage. println ( formatting. colored ( " <yellow> " , color: . yellow) + " \t - Will be updated, but not to the newest version "
89
+ + " because of the specified version in Cartfile " )
90
+ carthage. println ( formatting. colored ( " <red> " , color: . red) + " \t \t - Will not be updated because of the specified version in Cartfile " )
91
+ }
64
92
} else {
65
93
carthage. println ( " All dependencies are up to date. " )
66
94
}
0 commit comments