Add command line completions for installed and available versions.

When running `ghcup set ghc` and pressing tab, one should be able to
autocomplete the currently installed GHCs we have available.

Add an optparse applicative completer for install, rm, and set commands
which shows tags and versions. For installation, all are shown; while
for remove and set, only those installed are.
This commit is contained in:
Huw campbell
2021-02-25 00:18:11 +11:00
committed by Huw Campbell
parent eab82b5d63
commit d6fa61e223
2 changed files with 87 additions and 28 deletions

View File

@@ -808,3 +808,12 @@ getVersionInfo v' tool dls =
% _head
)
dls
-- Gathering monoidal values
traverseFold :: (Foldable t, Applicative m, Monoid b) => (a -> m b) -> t a -> m b
traverseFold f = foldl (\mb a -> (<>) <$> mb <*> f a) (pure mempty)
-- | Gathering monoidal values
forFold :: (Foldable t, Applicative m, Monoid b) => t a -> (a -> m b) -> m b
forFold = flip traverseFold