@@ -82,6 +82,8 @@ runOcto = do
8282 Restore tName ->
8383 handleRestore auth . coerce $ tName
8484 GetActionLogs aId l -> handleGetActionInfo auth aId l
85+ Delete tName ->
86+ handleDelete auth . coerce $ tName
8587
8688-- | Returns BaseUrl from 'OCTOPOD_URL' environment variable
8789-- or exit with exit_code=1.
@@ -181,6 +183,13 @@ handleCleanup auth dName = do
181183 liftIO $
182184 handleResponse (const $ pure ()) =<< runClientM (cleanupH auth dName) clientEnv
183185
186+-- | Handles the 'delete' subcommand.
187+handleDelete :: AuthContext AuthHeaderAuth -> DeploymentName -> ReaderT ClientEnv IO ()
188+handleDelete auth dName = do
189+ clientEnv <- ask
190+ liftIO $
191+ handleResponse (const $ pure ()) =<< runClientM (deleteH auth dName) clientEnv
192+
184193-- | Handles the 'restore' subcommand.
185194handleRestore :: AuthContext AuthHeaderAuth -> DeploymentName -> ReaderT ClientEnv IO ()
186195handleRestore auth dName = do
@@ -214,6 +223,7 @@ _statusH :: AuthContext AuthHeaderAuth -> DeploymentName -> ClientM CurrentDeplo
214223cleanupH :: AuthContext AuthHeaderAuth -> DeploymentName -> ClientM CommandResponse
215224restoreH :: AuthContext AuthHeaderAuth -> DeploymentName -> ClientM CommandResponse
216225getActionInfoH :: AuthContext AuthHeaderAuth -> ActionId -> ClientM ActionInfo
226+deleteH :: AuthContext AuthHeaderAuth -> DeploymentName -> ClientM CommandResponse
217227( listH
218228 :<|> createH
219229 :<|> archiveH
@@ -223,6 +233,7 @@ getActionInfoH :: AuthContext AuthHeaderAuth -> ActionId -> ClientM ActionInfo
223233 :<|> _statusH
224234 :<|> cleanupH
225235 :<|> restoreH
236+ :<|> deleteH
226237 )
227238 :<|> getActionInfoH = pushArrowIntoServantAlt $ client (Proxy @PowerAPI)
228239
@@ -264,13 +275,13 @@ decodeError body =
264275printInfo :: DeploymentInfo -> IO ()
265276printInfo (DeploymentInfo (Deployment _ dAppOvs dStOvs) (DeploymentMetadata dMeta) dLogs) = do
266277 T.putStrLn "Current settings:"
267− T.putStrLn $
268− "application config: "
269− <> formatOverrides dAppOvs
270− T.putStrLn $
271− "deployment config: "
272− <> formatOverrides dStOvs
273− T.putStrLn $ "metadata: "
278+ T.putStrLn "Application config:"
279+ putStrLn $ unlines $ formatOverrides False dAppOvs
280+ T.putStrLn ""
281+ T.putStrLn "Deployment config: "
282+ putStrLn $ unlines $ formatOverrides False dStOvs
283+ T.putStrLn ""
284+ T.putStrLn $ "Metadata: "
274285 forM_ dMeta $ \m ->
275286 T.putStrLn $
276287 " " <> m ^. #name <> ": " <> m ^. #link
@@ -282,15 +293,14 @@ ppDeploymentLogs :: [DeploymentLog] -> IO ()
282293ppDeploymentLogs ds =
283294 putStrLn
284295 . tableString
285− [ column expand right noAlign def
296+ [ column expand center noAlign def
297+ , column expand center noAlign def
286298 , column expand center noAlign def
287299 , column expand center noAlign def
288300 , column expand center noAlign def
289− , column expand left (charAlign '=') def
290− , column expand left (charAlign '=') def
291301 , column expand center noAlign def
292302 ]
293− unicodeBoldHeaderS
303+ unicodeDoubleFrameS
294304 ( titlesH
295305 [ "Created at"
296306 , "Action id"
@@ -303,17 +313,35 @@ ppDeploymentLogs ds =
303313 $ ppDeploymentLogRow <$> ds
304314
305315-- | Pretty-prints the deployment log.
306−ppDeploymentLogRow :: DeploymentLog -> RowGroup Text
316+ppDeploymentLogRow :: DeploymentLog -> RowGroup String
307317ppDeploymentLogRow dLog =
308318 colsAllG
309319 top
310320 [
311− [ T.pack . formatTime defaultTimeLocale (iso8601DateFormat (Just "%H:%M:%S")) $
321+ [ formatTime defaultTimeLocale (iso8601DateFormat (Just "%H:%M:%S")) $
312322 dLog ^. field @"createdAt"
313323 ]
314324 , [dLog ^. field @"actionId" . to unActionId . re _Show . packed]
315− , [dLog ^. field @"action" . to actionToText]
316− , dLog ^. field @"deploymentAppOverrides" . to formatOverrides'
317− , dLog ^. field @"deploymentDepOverrides" . to formatOverrides'
325+ , [dLog ^. field @"action" . to (T.unpack . actionToText)]
326+ , dLog ^. field @"deploymentAppOverrides" . to (stripBorder . formatOverrides True)
327+ , dLog ^. field @"deploymentDepOverrides" . to (stripBorder . formatOverrides True)
318328 , [dLog ^. field @"exitCode" . re _Show . packed]
319329 ]
330+
331+stripBorder :: [String] -> [String]
332+stripBorder = fmap (init . tail) . init . tail
333+
334+formatOverrides :: Bool -> Overrides l -> [String]
335+formatOverrides splitlines (Overrides m) =
336+ tableLines
337+ [ column expand right noAlign def
338+ , column expand left noAlign def
339+ ]
340+ unicodeS
341+ def
342+ $ showOverride <$> (reverse . OM.assocs) m
343+ where
344+ showOverride (k, v) =
345+ colsAllG top $ [if splitlines then T.chunksOf 15 k else [k], showValue v]
346+ showValue (ValueAdded v) = if splitlines then T.chunksOf 25 v else [v]
347+ showValue ValueDeleted = ["<<REMOVED>>"]