cmdargs

System.Console.CmdArgs.Explicit.Complete

Description

This module does command line completion

Synopsis

- data Complete
  - = CompleteValue String
  - | CompleteFile String FilePath
  - | CompleteDir String FilePath
- complete :: Mode a -> [String] -> (Int, Int) -> [Complete]
- completeBash :: String -> [String]
- completeZsh :: String -> [String]

# Documentation

data Complete

How to complete a command line option. The `Show` instance is suitable for parsing from shell scripts.

Constructors

CompleteValue String | Complete to a particular value
CompleteFile String FilePath | Complete to a prefix, and a file
CompleteDir String FilePath | Complete to a prefix, and a directory

Instances

Eq Complete |
Ord Complete |
Show Complete |

complete

Arguments

:: Mode a | Mode specifying which arguments are allowed
-> [String] | Arguments the user has already typed
-> (Int, Int) | 0-based index of the argument they are currently on, and the position in that argument
-> [Complete] |

Given a current state, return the set of commands you could type now, in preference order.

completeBash :: String -> [String]

completeZsh :: String -> [String]