| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Dojang.Commands.Disambiguation
Description
This module provides disambiguation logic for resolving ambiguous source paths when multiple routes map to the same destination.
Synopsis
- data AutoSelectMode
- disambiguateRoutes :: forall (i :: Type -> Type). (MonadFileSystem i, MonadIO i) => AutoSelectMode -> Maybe OsPath -> NonEmpty CandidateRoute -> App i (Maybe RouteResult)
- getAutoSelectMode :: MonadIO m => m AutoSelectMode
Documentation
data AutoSelectMode Source #
The mode for auto-selecting among ambiguous routes.
Constructors
| Interactive | Prompt the user interactively to select a route. |
| AutoSelectFirst | Automatically select the first route without prompting. |
| ErrorOnAmbiguity | Return an error when routes are ambiguous. |
Instances
| Show AutoSelectMode Source # | |
Defined in Dojang.Commands.Disambiguation Methods showsPrec :: Int -> AutoSelectMode -> ShowS # show :: AutoSelectMode -> String # showList :: [AutoSelectMode] -> ShowS # | |
| Eq AutoSelectMode Source # | |
Defined in Dojang.Commands.Disambiguation Methods (==) :: AutoSelectMode -> AutoSelectMode -> Bool # (/=) :: AutoSelectMode -> AutoSelectMode -> Bool # | |
Arguments
| :: forall (i :: Type -> Type). (MonadFileSystem i, MonadIO i) | |
| => AutoSelectMode | The auto-select mode. |
| -> Maybe OsPath | An explicit source path provided via |
| -> NonEmpty CandidateRoute | The candidate routes to disambiguate. |
| -> App i (Maybe RouteResult) | The selected route, or |
Disambiguate routes when multiple candidates exist.
The disambiguation strategy is:
- If an explicit source path is provided via
--source, use that. - If exactly one source file exists, auto-select it.
- Otherwise, apply the
AutoSelectMode:
Interactive- Prompt the user to select a route.AutoSelectFirst- Select the first route.ErrorOnAmbiguity- ReturnNothingto signal an error.
getAutoSelectMode :: MonadIO m => m AutoSelectMode Source #
Get the auto-select mode from the DOJANG_AUTO_SELECT environment
variable.
Possible values:
"first"- Auto-select the first route without prompting."error"- Return an error when routes are ambiguous.- (unset or other) - Prompt the user interactively.