module Kwpass:sig
..end
This module provides a number of ways of passing passwords to applications. A password source descriptor is used to describe the source of the password. The syntax is:
pass:PASSWORD
the password is PASSWORD
env:VARIABLE
the password is the value of the environment variable VARIABLE
file:FILENAME
the password is the contents of file FILENAME
, trimmed of whitespace on both endsrawfile:FILENAME
the password is the contents of file FILENAME
fd:DESCRIPTOR
NOT YET IMPLEMENTED stdin
the password is the contents of stdin, trimmed of whitespace on both endsrawstdin
the password is the contents of stdintype
passwordsrc =
| |
Pass of |
| |
Env of |
| |
File of |
| |
FD of |
| |
Stdin |
NYI: FD
type
rawness =
| |
Raw |
| |
Cooked |
Raw
password is extracted unchanged from
its source, while a Cooked
password is trimmed of whitespace on
both ends.typet =
passwordsrc * rawness
passwordsrc
and rawness
.exception Badpass of passwordsrc
passwordsrc
.val of_string : string -> t
of_string str
: convert a string which is a password source descriptor to a t
.
N.B.: there are no string representations for certain
combinations of passwordsrc
and rawness
.
val to_string : ?showpass:bool -> t -> string
to_string ?showpass t
: convert a t
to a password source descriptor
The actual text of the password will not be shown unless ~showpass:true
.
val getpass : t -> string
getpass t
: get a password from the t
, trimming it of
whitespace from beginning and end if not Raw
.val helpdata : (string * string) list
t
's.
The fst
of each pair shows the syntax of a t
, while the snd
describes it.
val helptext : ?indent:string -> ?sep1:string -> ?sep2:string -> string -> string
helptext ?indent ?sep1 ?sep2 title
: format up a paragraph of help text from helpdata
.indent
: string used to indent each line (prefix of each line) (default: " "
)sep1
: string that separates each fst
from each snd
(default: " "
)sep2
: string, that separates each pair from one another, and separates the title from the help text (default: sep2 ^ indent
)