ca-store now takes a --completion argument to output completions to standard output. These are to be used for completion scripts, in future commits. Before the 1.0.0 release we need to either: 1) Work out how to get bash et al to accept these completions without mangling them 2) Get optparse-applicative to handle the command parsing entirely and forgo the Moore machine approach
18 lines
561 B
Haskell
18 lines
561 B
Haskell
module Main(main) where
|
|
|
|
import CAStore.Command (runCommand)
|
|
import CAStore.Command.Autocomplete (generateAutocompletions)
|
|
import CAStore.Config (finalConfig)
|
|
import CAStore.Program (Program, runProgram, getCommand, getAutocomplete)
|
|
import CAStore.Program.IO.Text (err)
|
|
import CAStore.Program.Storage (initialise)
|
|
|
|
main :: IO ()
|
|
main = finalConfig >>= flip runProgram defaultProgram
|
|
|
|
defaultProgram :: Program ()
|
|
defaultProgram = do
|
|
initialise
|
|
getAutocomplete >>= \case
|
|
True -> generateAutocompletions
|
|
False -> getCommand >>= either err runCommand
|