ixEnvironment :: Map String String -> Map String String
fixEnvironment = appEndo
    $ foldMap (Endo . Map.delete . Text.unpack)
        (subcommandVariablesToRemove <> toolsetVariablesToRemove)
  where
    subcommandVariablesToRemove =
        getCommandWrapperVarName defaultCommandWrapperPrefix
        <$> [minBound .. maxBound]

    toolsetVariablesToRemove =
        getCommandWrapperToolsetVarName defaultCommandWrapperPrefix
        <$> List.filter isVariableRemovedBeforeInvokingExternalCommand
            [minBound .. maxBound]

fixEnvironment :: Map String String -> Map String String
fixEnvironment = appEndo
    $ foldMap (Endo . Map.delete . Text.unpack)
        (subcommandVariablesToRemove <> toolsetVariablesToRemove)
  where
    subcommandVariablesToRemove =
        getCommandWrapperVarName defaultCommandWrapperPrefix
        <$> [minBound .. maxBound]

    toolsetVariablesToRemove =
        getCommandWrapperToolsetVarName defaultCommandWrapperPrefix
        <$> List.filter isVariableRemovedBeforeInvokingExternalCommand
            [minBound .. maxBound]
fixEnvironment = appEndo
    $ foldMap (Endo . Map.delete . Text.unpack)
        (subcommandVariablesToRemove <> toolsetVariablesToRemove)
  where
    subcommandVariablesToRemove =
        getCommandWrapperVarName defaultCommandWrapperPrefix
        <$> [minBound .. maxBound]

    toolsetVariablesToRemove =
        getCommandWrapperToolsetVarName defaultCommandWrapperPrefix
        <$> List.filter isVariableRemovedBeforeInvokingExternalCommand
            [minBound .. maxBound]