@@ -13,14 +13,6 @@ module Reporting.Exit
1313 replToReport ,
1414 Validate (.. ),
1515 validateToReport ,
16- Uninstall (.. ),
17- uninstallToReport ,
18- Outdated (.. ),
19- outdatedToReport ,
20- Format (.. ),
21- FormattingFailure (.. ),
22- ValidateFailure (.. ),
23- formatToReport ,
2416 newPackageOverview ,
2517 --
2618 Solver (.. ),
@@ -44,7 +36,6 @@ import Data.ByteString qualified as BS
4436import Data.ByteString.UTF8 qualified as BS_UTF8
4537import Data.List qualified as List
4638import Data.Map qualified as Map
47- import Data.Maybe (mapMaybe )
4839import Data.Name qualified as N
4940import Data.NonEmptyList qualified as NE
5041import File qualified
@@ -63,7 +54,6 @@ import Reporting.Doc qualified as D
6354import Reporting.Error qualified as Error
6455import Reporting.Error.Import qualified as Import
6556import Reporting.Error.Json qualified as Json
66- import Reporting.Error.Syntax qualified as Error.Syntax
6757import Reporting.Exit.Help qualified as Help
6858import Reporting.Render.Code qualified as Code
6959import System.FilePath ((<.>) , (</>) )
@@ -830,63 +820,6 @@ toDocsProblemReport problem context =
830820 \ for some reason."
831821 ]
832822
833- -- UNINSTALL
834-
835- data Uninstall
836- = UninstallNoOutline
837- | UninstallBadOutline Outline
838- | UninstallHadSolverTrouble Solver
839- | UninstallNoSolverSolution
840- | UninstallBadDetails Details
841-
842- uninstallToReport :: Uninstall -> Help. Report
843- uninstallToReport exit =
844- case exit of
845- UninstallNoOutline ->
846- Help. report
847- " COULD NOT FIND PROJECT"
848- Nothing
849- " I could not locate the gren.json file of your project."
850- []
851- UninstallBadOutline outline ->
852- toOutlineReport outline
853- UninstallHadSolverTrouble solver ->
854- toSolverReport solver
855- UninstallNoSolverSolution ->
856- Help. report
857- " COULD NOT RESOLVE DEPENDENCIES"
858- (Just " gren.json" )
859- ( " After removing the package I was unable to resolve your project's dependencies.\
860- \ I'm not sure how this can happen. It might be a good idea to reach out to the Gren\
861- \ core team."
862- )
863- []
864- UninstallBadDetails details ->
865- toDetailsReport details
866-
867- -- OUTDATED
868-
869- data Outdated
870- = OutdatedNoOutline
871- | OutdatedBadOutline Outline
872- | OutdatedGitTrouble ()
873-
874- outdatedToReport :: Outdated -> Help. Report
875- outdatedToReport exit =
876- case exit of
877- OutdatedNoOutline ->
878- Help. report
879- " COULD NOT FIND PROJECT"
880- Nothing
881- " I could not locate the gren.json file of your project."
882- []
883- OutdatedBadOutline outline ->
884- toOutlineReport outline
885- OutdatedGitTrouble gitError ->
886- toGitErrorReport
887- " PROBLEM FINDING OUTDATED PACKAGE VERSIONS"
888- gitError
889- " I tried to find newer versions of the dependencies specified in your gren.json file."
890823
891824-- SOLVER
892825
@@ -2516,78 +2449,3 @@ replToReport problem =
25162449 corruptCacheReport
25172450 ReplBlocked ->
25182451 corruptCacheReport
2519-
2520- -- FORMAT
2521-
2522- data Format
2523- = FormatPathUnknown FilePath
2524- | FormatStdinWithFiles
2525- | FormatNoOutline
2526- | FormatBadOutline Outline
2527- | FormatValidateErrors (NE. List ValidateFailure )
2528- | FormatErrors (NE. List FormattingFailure )
2529-
2530- data FormattingFailure
2531- = FormattingFailureParseError (Maybe FilePath ) BS. ByteString Error.Syntax. Error
2532-
2533- data ValidateFailure
2534- = VaildateFormattingFailure FormattingFailure
2535- | ValidateNotCorrectlyFormatted
2536-
2537- formatToReport :: Format -> Help. Report
2538- formatToReport problem =
2539- case problem of
2540- FormatPathUnknown path ->
2541- Help. report
2542- " FILE NOT FOUND"
2543- Nothing
2544- " I cannot find this file:"
2545- [ D. indent 4 $ D. red $ D. fromChars path,
2546- D. reflow $ " Is there a typo?" ,
2547- D. toSimpleNote $
2548- " If you are just getting started, try working through the examples in the\
2549- \ official guide https://gren-lang.org/learn to get an idea of the kinds of things\
2550- \ that typically go in a src/Main.gren file."
2551- ]
2552- FormatStdinWithFiles ->
2553- Help. report
2554- " INCOMPATIBLE FLAGS"
2555- Nothing
2556- " Files and stdin cannot be formatted at the same time."
2557- [ D. reflow " You'll need to run `gren format` two separate times if you want to do both."
2558- ]
2559- FormatNoOutline ->
2560- Help. report
2561- " FORMAT WHAT?"
2562- Nothing
2563- " I cannot find a gren.json so I am not sure what you want me to format.\
2564- \ Normally you run `gren format` from within a project!"
2565- [ D. reflow $ " If you need to format gren files outside of a project, tell me which files or directories to format:" ,
2566- D. indent 4 $ D. green $ " gren format Example.gren"
2567- ]
2568- FormatBadOutline outline ->
2569- toOutlineReport outline
2570- FormatValidateErrors errors ->
2571- Help. report
2572- " FILES NOT PROPERLY FORMATTED"
2573- Nothing
2574- " The input files were not correctly formatted according to Gren's preferred style."
2575- (mapMaybe validateErrorToDoc $ NE. toList errors)
2576- FormatErrors errors ->
2577- Help. report
2578- (show (length errors) <> " FILES CONTAINED ERRORS" )
2579- Nothing
2580- " Some files contained errors and could not be formatted:"
2581- (formattingErrorToDoc <$> NE. toList errors)
2582-
2583- formattingErrorToDoc :: FormattingFailure -> D. Doc
2584- formattingErrorToDoc formattingError =
2585- case formattingError of
2586- FormattingFailureParseError path source err ->
2587- Help. syntaxErrorToDoc (Code. toSource source) path err
2588-
2589- validateErrorToDoc :: ValidateFailure -> Maybe D. Doc
2590- validateErrorToDoc validateError =
2591- case validateError of
2592- VaildateFormattingFailure formattingFailure -> Just $ formattingErrorToDoc formattingFailure
2593- ValidateNotCorrectlyFormatted -> Nothing
0 commit comments