on master help sign in
Delete clidemo
e8eb90eElliot Cameron
lib/cliapp/obelisk-cliapp.cabal−1
@@ -25,7 +25,6 @@ library
25 , transformers
25 , transformers
26 exposed-modules:
26 exposed-modules:
27 Obelisk.CliApp
27 Obelisk.CliApp
28− Obelisk.CliApp.Demo
29 other-modules:
28 other-modules:
30 Obelisk.CliApp.Logging
29 Obelisk.CliApp.Logging
31 Obelisk.CliApp.Process
30 Obelisk.CliApp.Process
lib/cliapp/src/Obelisk/CliApp/Demo.hsdeleted−52
@@ -1,52 +0,0 @@
1−{-# LANGUAGE FlexibleContexts #-}
2−{-# LANGUAGE OverloadedStrings #-}
3−{-# LANGUAGE ScopedTypeVariables #-}
4−module Obelisk.CliApp.Demo where
5−
6−import Control.Concurrent (threadDelay)
7−import Control.Monad.Fail
8−import Control.Monad.IO.Class
9−import Data.Semigroup ((<>))
10−import qualified Data.Text as T
11−
12−import Control.Monad.Catch (MonadMask)
13−
14−import Obelisk.CliApp
15−
16−cliDemo
17− :: ( MonadIO m, MonadMask m, MonadFail m
18− , CliLog m, HasCliConfig e m, CliThrow e m, AsProcessFailure e, AsUnstructuredError e)
19− => m ()
20−cliDemo = withSpinner "CLI Demo" $ do
21− putLog Notice "This demo will showcase the CLI library functionality"
22− _ <- withSpinner' "Searching long for something" (Just $ \c -> "Discovered " <> T.pack (show c) <> " objects") $ do
23− delay
24− withSpinner "Nested task" $ do
25− delay
26− putLog Notice "In nested task"
27− -- This is a 'no trail' spinner that won't leave a trail (even its sub spinners)
28− withSpinnerNoTrail "In between, doing something temporary" $ do
29− withSpinner "Runnning something deep inside" $ do
30− delay
31− putLog Notice "You can still log from inside no-trail spinners"
32− delay
33− delay
34− putLog Error "Top nested task finished"
35− delay
36− putLog Error "Some user error while spinning"
37− delay
38− putLog Notice "This is some info mesage"
39− putLog Warning "And now a warning as well"
40− delay
41− return (42 :: Integer)
42− putLog Notice "Now we start a 2nd spinner, run a couple of process, the last of which fails:"
43− withSpinner "Looking around" $ do
44− delay
45− output <- readProcessAndLogStderr Notice $ proc "ls" ["-l", "/"]
46− putLog Notice $ "Output was: " <> output
47− delay
48− callProcessAndLogOutput (Notice, Error) $ proc "ls" ["-l", "/does-not-exist"]
49− delay
50− failWith "Something dangerous happened"
51− where
52− delay = liftIO $ threadDelay 1000000
lib/command/src/Obelisk/Command.hs−4
@@ -30,7 +30,6 @@ import System.Posix.Process (executeFile)
30
30
31import Obelisk.App
31import Obelisk.App
32import Obelisk.CliApp
32import Obelisk.CliApp
33−import Obelisk.CliApp.Demo (cliDemo)
34import Obelisk.Command.Deploy
33import Obelisk.Command.Deploy
35import Obelisk.Command.Project
34import Obelisk.Command.Project
36import Obelisk.Command.Run
35import Obelisk.Command.Run
@@ -101,7 +100,6 @@ data ObCommand
101
100
102data ObInternal
101data ObInternal
103 = ObInternal_RunStaticIO StaticKey
102 = ObInternal_RunStaticIO StaticKey
104− | ObInternal_CLIDemo
105 -- the preprocessor argument syntax is also handled outside
103 -- the preprocessor argument syntax is also handled outside
106 -- optparse-applicative, but it shouldn't ever conflict with another syntax
104 -- optparse-applicative, but it shouldn't ever conflict with another syntax
107 | ObInternal_ApplyPackages String String String [String]
105 | ObInternal_ApplyPackages String String String [String]
@@ -196,7 +194,6 @@ data DeployInitOpts = DeployInitOpts
196internalCommand :: Parser ObInternal
194internalCommand :: Parser ObInternal
197internalCommand = subparser $ mconcat
195internalCommand = subparser $ mconcat
198 [ command "run-static-io" $ info (ObInternal_RunStaticIO <$> argument (eitherReader decodeStaticKey) (action "static-key")) mempty
196 [ command "run-static-io" $ info (ObInternal_RunStaticIO <$> argument (eitherReader decodeStaticKey) (action "static-key")) mempty
199− , command "clidemo" $ info (pure ObInternal_CLIDemo) mempty
200 ]
197 ]
201
198
202--TODO: Result should provide normalised path and also original user input for error reporting.
199--TODO: Result should provide normalised path and also original user input for error reporting.
@@ -400,7 +397,6 @@ ob = \case
400 Just p -> do
397 Just p -> do
401 c <- getObelisk
398 c <- getObelisk
402 liftIO $ runObelisk c $ deRefStaticPtr p
399 liftIO $ runObelisk c $ deRefStaticPtr p
403− ObInternal_CLIDemo -> cliDemo -- TODO: DELETE
404 ObInternal_ApplyPackages origPath inPath outPath packagePaths -> do
400 ObInternal_ApplyPackages origPath inPath outPath packagePaths -> do
405 liftIO $ Preprocessor.applyPackages origPath inPath outPath packagePaths
401 liftIO $ Preprocessor.applyPackages origPath inPath outPath packagePaths
406
402