arseOptions :: Options.Parser (Action -> Action)
parseOptions = asum
    [ Options.flag' (const (Run True)) (Options.long "notify")
    , expressionOption <*> Options.switch (Options.long "notify")
    , Options.flag' (const List) $ mconcat
        [ Options.short 'l'
        , Options.long "list"
        , Options.long "ls"
        ]
    , Options.flag' (const Tree) (Options.long "tree" <> Options.short 't')
    , Options.flag' (\i s _ -> DryRunCompletion i s) (Options.long "print-completion")
        <*> indexOption
        <*> shellOption
    , Options.flag' (const DryRun) (Options.long "print")

    , pure id
    ]
  where
    expressionOption =
        Options.strOption (Options.long "expression") <&> \expr m _ ->
            RunDhall m expr

    indexOption :: Options.Parser Word
    indexOption = Options.option Options.auto (Options.long "index")

    shellOption :: Options.Parser Shell
    shellOption = Options.option
        (Options.maybeReader (Shell.parse . CaseInsensitive.mk))
        (Options.long "shell")

parseOptions :: Options.Parser (Action -> Action)
parseOptions = asum
    [ Options.flag' (const (Run True)) (Options.long "notify")
    , expressionOption <*> Options.switch (Options.long "notify")
    , Options.flag' (const List) $ mconcat
        [ Options.short 'l'
        , Options.long "list"
        , Options.long "ls"
        ]
    , Options.flag' (const Tree) (Options.long "tree" <> Options.short 't')
    , Options.flag' (\i s _ -> DryRunCompletion i s) (Options.long "print-completion")
        <*> indexOption
        <*> shellOption
    , Options.flag' (const DryRun) (Options.long "print")

    , pure id
    ]
  where
    expressionOption =
        Options.strOption (Options.long "expression") <&> \expr m _ ->
            RunDhall m expr

    indexOption :: Options.Parser Word
    indexOption = Options.option Options.auto (Options.long "index")

    shellOption :: Options.Parser Shell
    shellOption = Options.option
        (Options.maybeReader (Shell.parse . CaseInsensitive.mk))
        (Options.long "shell")
parseOptions = asum
    [ Options.flag' (const (Run True)) (Options.long "notify")
    , expressionOption <*> Options.switch (Options.long "notify")
    , Options.flag' (const List) $ mconcat
        [ Options.short 'l'
        , Options.long "list"
        , Options.long "ls"
        ]
    , Options.flag' (const Tree) (Options.long "tree" <> Options.short 't')
    , Options.flag' (\i s _ -> DryRunCompletion i s) (Options.long "print-completion")
        <*> indexOption
        <*> shellOption
    , Options.flag' (const DryRun) (Options.long "print")

    , pure id
    ]
  where
    expressionOption =
        Options.strOption (Options.long "expression") <&> \expr m _ ->
            RunDhall m expr

    indexOption :: Options.Parser Word
    indexOption = Options.option Options.auto (Options.long "index")

    shellOption :: Options.Parser Shell
    shellOption = Options.option
        (Options.maybeReader (Shell.parse . CaseInsensitive.mk))
        (Options.long "shell")