[CLI] simplified routes sorting

Route implements Ord so no need to import Internal stuff
parent 6795382b
...@@ -19,7 +19,6 @@ import Gargantext.Prelude ...@@ -19,7 +19,6 @@ import Gargantext.Prelude
import Options.Applicative import Options.Applicative
import Servant.API import Servant.API
import Servant.API.Routes import Servant.API.Routes
import Servant.API.Routes.Internal.Route (routeMethod, routePath)
import Servant.API.WebSocket qualified as WS (WebSocketPending) import Servant.API.WebSocket qualified as WS (WebSocketPending)
import Servant.Auth qualified as Servant import Servant.Auth qualified as Servant
...@@ -54,10 +53,6 @@ instance HasRoutes Raw where ...@@ -54,10 +53,6 @@ instance HasRoutes Raw where
routesCLI :: CLIRoutes -> IO () routesCLI :: CLIRoutes -> IO ()
routesCLI = \case routesCLI = \case
CLIR_list CLIR_list
-> do -> traverse_ (T.putStrLn . renderRoute) . sort $ getRoutes @(NamedRoutes API)
let routes = getRoutes @(NamedRoutes API)
let cmpFunc r = (renderPath (r ^. routePath), r ^. routeMethod)
let sortedRoutes = sortBy (\a b -> compare (cmpFunc a) (cmpFunc b)) routes
traverse_ (T.putStrLn . renderRoute) sortedRoutes
(CLIR_export filePath) (CLIR_export filePath)
-> B.writeFile filePath . BL.toStrict $ encodePretty (getRoutes @(NamedRoutes API)) -> B.writeFile filePath . BL.toStrict $ encodePretty (getRoutes @(NamedRoutes API))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment