Skip to content

Commit ce23831

Browse files
harendra-kumaradithyaov
authored andcommitted
Print Internal/Released APIs separately, print legend
1 parent 07e7077 commit ce23831

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

cli/Main.hs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ mainSingle args = do
9696
(mapAttachment (DRight . parseDoc))
9797
(mapAttachment (DRight . parseDoc))
9898
(mapAttachment (DRight . parseDoc)))
99-
step "Printing API"
10099
let elems =
101100
[ ELClasses
102101
, ELDataTypes True
@@ -113,12 +112,17 @@ mainSingle args = do
113112
isDeprecated anns
114113
isDeprecatedInRight _ = False
115114

116-
let apiFiltered =
115+
let apiReleased =
117116
Map.filterWithKey
118117
(\k v -> not (isInternal k) && not (isDeprecatedInRight v))
119118
api1
119+
let apiInternal =
120+
Map.filterWithKey (\k _ -> isInternal k) api1
120121

121-
putStrLn $ prettyAPI elems apiFiltered
122+
step "Released API"
123+
putStrLn $ prettyAPI elems apiReleased
124+
step "Internal API"
125+
putStrLn $ prettyAPI elems apiInternal
122126

123127
mainDiff :: [String] -> IO ()
124128
mainDiff args = do
@@ -147,7 +151,15 @@ mainDiff args = do
147151
(mapAttachment (DRight . parseDoc))
148152
(mapAttachment (DRight . parseDoc))
149153
(mapAttachment (DRight . parseDoc)))
150-
step "Printing diff"
154+
155+
step "API Annotations"
156+
putStrLn "[A] : Added"
157+
putStrLn "[R] : Removed"
158+
putStrLn "[C] : Changed"
159+
putStrLn "[O] : Old definition"
160+
putStrLn "[N] : New definition"
161+
putStrLn "[D] : Deprecated"
162+
151163
let elems =
152164
[ ELClasses
153165
, ELDataTypes True
@@ -167,12 +179,18 @@ mainDiff args = do
167179
isDeprecatedInLeft (Tagged (Attach (DBoth anns _) _) _) =
168180
isDeprecated anns
169181
isDeprecatedInLeft _ = False
170-
let diff =
182+
let diffRel =
171183
let filt k v =
172184
not (isInternal k)
173185
&& not (isDeprecatedInBoth v || isDeprecatedInLeft v)
174186
in Map.filterWithKey filt (diffAPI api1 api2)
175-
putStrLn $ prettyAPI elems diff
187+
let diffInt =
188+
let filt k _ = isInternal k
189+
in Map.filterWithKey filt (diffAPI api1 api2)
190+
step "API diff"
191+
putStrLn $ prettyAPI elems diffRel
192+
step "Internal API diff"
193+
putStrLn $ prettyAPI elems diffInt
176194

177195
main :: IO ()
178196
main = do

0 commit comments

Comments
 (0)