Show label in summary, Shorten long command label, cleanup
parent
78a32ebece
commit
bb0417d2a3
|
@ -103,7 +103,7 @@ data KeepMode
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
data Config = Config
|
data Config = Config
|
||||||
{ c_command :: String
|
{ c_label :: String
|
||||||
, c_lines :: Int
|
, c_lines :: Int
|
||||||
, c_keepStdout :: KeepMode
|
, c_keepStdout :: KeepMode
|
||||||
, c_keepStderr :: KeepMode
|
, c_keepStderr :: KeepMode
|
||||||
|
@ -155,8 +155,7 @@ stateLine updateCur showCur = do
|
||||||
diffFloat1
|
diffFloat1
|
||||||
(s_countOut s)
|
(s_countOut s)
|
||||||
(s_countErr s)
|
(s_countErr s)
|
||||||
|
pure $ outStr
|
||||||
pure $ fGrey ++ outStr
|
|
||||||
|
|
||||||
firstJust :: (a -> Maybe b) -> [a] -> Maybe b
|
firstJust :: (a -> Maybe b) -> [a] -> Maybe b
|
||||||
firstJust f = listToMaybe . mapMaybe f
|
firstJust f = listToMaybe . mapMaybe f
|
||||||
|
@ -433,9 +432,9 @@ updateStateLine updateCur = do
|
||||||
( fGrey
|
( fGrey
|
||||||
++ "╰─ … "
|
++ "╰─ … "
|
||||||
++ line
|
++ line
|
||||||
++ " "
|
++ ", "
|
||||||
++ setFGColorVivid Ansi.Blue
|
++ setFGColorVivid Ansi.Blue
|
||||||
++ (c_command $ s_config s)
|
++ (c_label $ s_config s)
|
||||||
++ fReset
|
++ fReset
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -539,8 +538,10 @@ main = B.mainFromCmdParser $ do
|
||||||
line0 <- openConsoleRegion Linear
|
line0 <- openConsoleRegion Linear
|
||||||
pure State
|
pure State
|
||||||
{ s_config = Config
|
{ s_config = Config
|
||||||
{ c_command = case label of
|
{ c_label = case label of
|
||||||
[] -> unwords $ map quoteIfSpaces rest
|
[] ->
|
||||||
|
let full = unwords $ map quoteIfSpaces rest
|
||||||
|
in if length full < 80 then full else head rest
|
||||||
[labelStr] -> labelStr
|
[labelStr] -> labelStr
|
||||||
_ -> error "too many labels!"
|
_ -> error "too many labels!"
|
||||||
, c_lines = numLines
|
, c_lines = numLines
|
||||||
|
@ -645,9 +646,16 @@ main = B.mainFromCmdParser $ do
|
||||||
finalState <- takeMVar stateVar
|
finalState <- takeMVar stateVar
|
||||||
line <- evalStateT (stateLine False False) finalState
|
line <- evalStateT (stateLine False False) finalState
|
||||||
s_regions finalState `forM_` \r -> closeConsoleRegion r
|
s_regions finalState `forM_` \r -> closeConsoleRegion r
|
||||||
|
let prefix =
|
||||||
|
fGrey
|
||||||
|
++ line
|
||||||
|
++ ", "
|
||||||
|
++ setFGColorVivid Ansi.Blue
|
||||||
|
++ (c_label $ s_config finalState)
|
||||||
|
++ fGrey
|
||||||
let lastLine = case ecMay of
|
let lastLine = case ecMay of
|
||||||
Nothing -> fGrey ++ line ++ ", UserInterrupt\n" ++ fReset
|
Nothing -> prefix ++ ", UserInterrupt\n" ++ fReset
|
||||||
Just ec -> fGrey ++ line ++ ", ec=" ++ showEC ec ++ "\n"
|
Just ec -> prefix ++ ", ec=" ++ showEC ec ++ "\n"
|
||||||
pure (lastLine, ecMay)
|
pure (lastLine, ecMay)
|
||||||
|
|
||||||
flushConcurrentOutput
|
flushConcurrentOutput
|
||||||
|
|
Loading…
Reference in New Issue