Add ansi terminal skeleton
This commit is contained in:
18
app/ghcup/AnsiMain.hs
Normal file
18
app/ghcup/AnsiMain.hs
Normal file
@@ -0,0 +1,18 @@
|
||||
module AnsiMain where
|
||||
|
||||
import GHCup
|
||||
import GHCup.Download
|
||||
import GHCup.Errors
|
||||
import GHCup.Types.Optics ( getDirs )
|
||||
import GHCup.Types hiding ( LeanAppState(..) )
|
||||
import GHCup.Utils
|
||||
import GHCup.Prelude ( decUTF8Safe )
|
||||
import GHCup.Prelude.File
|
||||
import GHCup.Prelude.Logger
|
||||
import GHCup.Prelude.Process
|
||||
|
||||
ansiMain :: AppState
|
||||
-> IO ()
|
||||
ansiMain s = do
|
||||
putStrLn "ansi terminal"
|
||||
pure ()
|
||||
@@ -104,6 +104,9 @@ data Command
|
||||
| Nuke
|
||||
#if defined(BRICK)
|
||||
| Interactive
|
||||
#endif
|
||||
#if defined(ANSI)
|
||||
| InteractiveAnsi
|
||||
#endif
|
||||
| Prefetch PrefetchCommand
|
||||
| GC GCOptions
|
||||
@@ -184,8 +187,19 @@ opts =
|
||||
com :: Parser Command
|
||||
com =
|
||||
subparser
|
||||
#if defined(BRICK)
|
||||
#if defined(ANSI)
|
||||
( command
|
||||
"tui-ansi"
|
||||
( (\_ -> InteractiveAnsi)
|
||||
<$> info
|
||||
helper
|
||||
( progDesc "Start the interactive GHCup UI (ansi)"
|
||||
)
|
||||
)
|
||||
<>
|
||||
#endif
|
||||
#if defined(BRICK)
|
||||
command
|
||||
"tui"
|
||||
( (\_ -> Interactive)
|
||||
<$> info
|
||||
@@ -195,7 +209,7 @@ com =
|
||||
)
|
||||
<> command
|
||||
#else
|
||||
( command
|
||||
command
|
||||
#endif
|
||||
"install"
|
||||
( Install
|
||||
|
||||
@@ -13,6 +13,9 @@ module Main where
|
||||
#if defined(BRICK)
|
||||
import BrickMain ( brickMain )
|
||||
#endif
|
||||
#if defined(ANSI)
|
||||
import AnsiMain ( ansiMain )
|
||||
#endif
|
||||
|
||||
import qualified GHCup.GHC as GHC
|
||||
import qualified GHCup.HLS as HLS
|
||||
@@ -234,6 +237,9 @@ Report bugs at <https://github.com/haskell/ghcup-hs/issues>|]
|
||||
UnSet _ -> pure ()
|
||||
#if defined(BRICK)
|
||||
Interactive -> pure ()
|
||||
#endif
|
||||
#if defined(ANSI)
|
||||
InteractiveAnsi -> pure ()
|
||||
#endif
|
||||
-- check for new tools
|
||||
_
|
||||
@@ -292,6 +298,11 @@ Report bugs at <https://github.com/haskell/ghcup-hs/issues>|]
|
||||
Interactive -> do
|
||||
s' <- appState
|
||||
liftIO $ brickMain s' >> pure ExitSuccess
|
||||
#endif
|
||||
#if defined(ANSI)
|
||||
InteractiveAnsi -> do
|
||||
s' <- appState
|
||||
liftIO $ ansiMain s' >> pure ExitSuccess
|
||||
#endif
|
||||
Install installCommand -> install installCommand settings appState runLogger
|
||||
InstallCabalLegacy iopts -> install (Left (InstallCabal iopts)) settings appState runLogger
|
||||
|
||||
Reference in New Issue
Block a user