Skip to content

Commit

Permalink
[#452] Use colourista-0.1.0.0 (#461)
Browse files Browse the repository at this point in the history
* [#452] Use colourista-0.1.0.0

Resolves #452

* Fix CI
  • Loading branch information
chshersh authored May 21, 2020
1 parent 122464b commit 73da3ae
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 67 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ The changelog is available [on GitHub][2].
Bump up `tomland` version to `1.3.0.0`.
* [#455](https://github.com/kowainik/summoner/issues/455):
Allow `validation-selective` version `0.1.0.0`.
* [#452](https://github.com/kowainik/summoner/issues/452):
Bump up `colourista` version to `0.1.0.0`. Remove the
`Summoner.Ansi` module.

## 2.0.0.0 – Mar 28, 2019

Expand Down
1 change: 1 addition & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ packages:
- summoner-tui/

extra-deps:
- colourista-0.1.0.0
- generic-data-0.8.0.0
- hspec-hedgehog-0.0.1.1
- tomland-1.3.0.0
Expand Down
1 change: 0 additions & 1 deletion summoner-cli/src/Summoner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module Summoner
( module Summoner
) where

import Summoner.Ansi as Summoner
import Summoner.CLI as Summoner
import Summoner.Config as Summoner
import Summoner.CustomPrelude as Summoner
Expand Down
52 changes: 0 additions & 52 deletions summoner-cli/src/Summoner/Ansi.hs

This file was deleted.

4 changes: 2 additions & 2 deletions summoner-cli/src/Summoner/CLI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ module Summoner.CLI
, getCustomLicenseText
) where

import Colourista (blue, bold, formatWith)
import Colourista (blue, bold, errorMessage, formatWith, infoMessage, successMessage,
warningMessage)
import Data.Version (Version, showVersion)
import Development.GitRev (gitCommitDate, gitHash)
import NeatInterpolation (text)
Expand All @@ -45,7 +46,6 @@ import System.Directory (doesFileExist)
import System.Info (os)
import Validation (Validation (..))

import Summoner.Ansi (errorMessage, infoMessage, successMessage, warningMessage)
import Summoner.Config (Config, ConfigP (..), PartialConfig, defaultConfig, finalise,
guessConfigFromGit, loadFileConfig)
import Summoner.CustomPrelude (CustomPrelude (..))
Expand Down
2 changes: 1 addition & 1 deletion summoner-cli/src/Summoner/CustomPrelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Summoner.CustomPrelude
, customPreludeT
) where

import Toml (Key, TomlCodec, (.=))
import Toml (TomlCodec, (.=))

import Summoner.Text (moduleNameValid, packageNameValid)

Expand Down
3 changes: 1 addition & 2 deletions summoner-cli/src/Summoner/License.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ module Summoner.License
, showLicenseWithDesc
) where

import Colourista (errorMessage)
import Data.Aeson (FromJSON (..), decodeStrict, withObject, (.:))
import Relude.Extra.Enum (inverseMap)
import Shellmet (($|))

import Summoner.Ansi (errorMessage)

import qualified Data.Text as T
import qualified Text.Show as TS

Expand Down
6 changes: 3 additions & 3 deletions summoner-cli/src/Summoner/Project.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ module Summoner.Project
, initializeProject
) where

import Colourista (bold, formattedMessage, green)
import Colourista (bold, errorMessage, formattedMessage, green, infoMessage, skipMessage,
successMessage, warningMessage)
import NeatInterpolation (text)
import Relude.Extra.Enum (universe)
import Shellmet (($?))
import System.Directory (findExecutable, setCurrentDirectory)

import Summoner.Ansi (errorMessage, infoMessage, skipMessage, successMessage, warningMessage)
import Summoner.Config (Config, ConfigP (..))
import Summoner.CustomPrelude (CustomPrelude (..))
import Summoner.Decision (Decision (..), decisionToBool, decisionsToBools, promptDecisionToBool)
Expand Down Expand Up @@ -277,7 +277,7 @@ createProjectDirectory :: Settings -> IO ()
createProjectDirectory settings@Settings{..} = do
let tree = createProjectTemplate settings
traverseTree tree
successMessage "\nThe project with the following structure has been created:"
successMessage "The project with the following structure has been created:"
putTextLn $ showBoldTree tree
setCurrentDirectory (toString settingsRepo)

Expand Down
25 changes: 23 additions & 2 deletions summoner-cli/src/Summoner/Question.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ module Summoner.Question
, falseMessage
) where

import Colourista (bold, cyan, formatWith, formattedMessage, green, italic)
import Colourista (blue, bold, cyan, errorMessage, formatWith, formattedMessage, green, italic,
warningMessage)
import System.Directory (doesPathExist, getCurrentDirectory)
import System.FilePath ((</>))
import System.IO (hFlush)

import Summoner.Ansi (boldDefault, errorMessage, prompt, putStrFlush, warningMessage)
import Summoner.Text (headToUpper, intercalateMap)

import qualified Data.Text as T
Expand Down Expand Up @@ -274,3 +275,23 @@ doesExistProjectName :: Text -> IO Bool
doesExistProjectName projectName = do
curPath <- getCurrentDirectory
doesPathExist $ curPath </> toString projectName

----------------------------------------------------------------------------
-- Internal implementation details
----------------------------------------------------------------------------

-- | Explicit flush ensures prompt messages are in the correct order on all systems.
putStrFlush :: Text -> IO ()
putStrFlush msg = do
putText msg
hFlush stdout

{- | Read 'Text' from standard input after arrow prompt.
-}
prompt :: IO Text
prompt = do
putStrFlush $ formatWith [blue] " -> "
T.strip <$> getLine

boldDefault :: Text -> Text
boldDefault message = formatWith [bold] $ " [" <> message <> "]"
2 changes: 1 addition & 1 deletion summoner-cli/src/Summoner/Source.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ module Summoner.Source
, fetchSource
) where

import Colourista (errorMessage, infoMessage)
import Control.Exception (catch)
import System.Process (readProcess)
import Toml (TomlBiMapError (..), TomlCodec)

import Summoner.Ansi (errorMessage, infoMessage)
import Summoner.Mode (ConnectMode (..), isOffline)
import Summoner.Tree (TreeFs, pathToTree)

Expand Down
3 changes: 1 addition & 2 deletions summoner-cli/summoner.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ library
import: common-options
hs-source-dirs: src
exposed-modules: Summoner
Summoner.Ansi
Summoner.CLI
Summoner.Config
Summoner.CustomPrelude
Expand Down Expand Up @@ -141,7 +140,7 @@ library

build-depends: aeson >= 1.2.4.0 && < 1.5
, bytestring ^>= 0.10.8.2
, colourista ^>= 0.0
, colourista ^>= 0.1
, containers ^>= 0.6
, directory ^>= 1.3.0.2
, filepath ^>= 1.4.1.2
Expand Down
2 changes: 1 addition & 1 deletion summoner-tui/src/Summoner/Tui.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import Brick.Widgets.Core (emptyWidget, fill, hLimit, hLimitPercent, padTopBotto
vLimit, viewport)
import Brick.Widgets.Edit (editAttr, editFocusedAttr)
import Brick.Widgets.List (listSelectedAttr, listSelectedFocusedAttr)
import Colourista (errorMessage, infoMessage)
import Lens.Micro ((.~), (^.))
import Relude.Extra.Enum (universe)
import System.Directory (doesDirectoryExist, doesFileExist, getCurrentDirectory, listDirectory)

import Summoner.Ansi (errorMessage, infoMessage)
import Summoner.CLI (Command (..), NewOpts (..), ShowOpts (..), getCustomLicenseText,
getFinalConfig, runConfig, runScript, summon)
import Summoner.Config (ConfigP (cFiles))
Expand Down
1 change: 1 addition & 0 deletions summoner-tui/summoner-tui.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ library
other-modules: Paths_summoner_tui

build-depends: brick >= 0.47 && < 0.53
, colourista ^>= 0.1
, directory ^>= 1.3.0.2
, filepath ^>= 1.4.1.2
, microlens ^>= 0.4
Expand Down

0 comments on commit 73da3ae

Please sign in to comment.