package cmdlang

  1. Overview
  2. Docs

Module Command.ArgSource

Refer to the Arguments terminology.

Sourcetype 'a t

Applicative operations

Sourceval return : 'a -> 'a t
Sourceval apply : ('a -> 'b) t -> 'a t -> 'b t
Sourceval map : 'a t -> f:('a -> 'b) -> 'b t
Sourceval both : 'a t -> 'b t -> ('a * 'b) t

Named arguments

Sourceval flag : string Nonempty_list.t -> doc:string -> bool t

A flag that may appear at most once on the command line.

Sourceval flag_count : string Nonempty_list.t -> doc:string -> int t

A flag that may appear multiple times on the command line. Evaluates to the number of times the flag appeared.

Sourceval named : ?docv:string -> string Nonempty_list.t -> 'a Param.t -> doc:string -> 'a t

A required named argument (must appear exactly once on the command line).

Sourceval named_multi : ?docv:string -> string Nonempty_list.t -> 'a Param.t -> doc:string -> 'a list t

A named argument that may appear multiple times on the command line.

Sourceval named_opt : ?docv:string -> string Nonempty_list.t -> 'a Param.t -> doc:string -> 'a option t

An optional named argument (may appear at most once).

Sourceval named_with_default : ?docv:string -> string Nonempty_list.t -> 'a Param.t -> default:'a -> doc:string -> 'a t

An optional named argument with a default value.

Positional arguments

Positional argument start at index 0.

Sourceval pos : ?docv:string -> pos:int -> 'a Param.t -> doc:string -> 'a t

A required positional argument. It must appear exactly once at position i on the command line.

Sourceval pos_opt : ?docv:string -> pos:int -> 'a Param.t -> doc:string -> 'a option t

An optional positional argument at position i. Optional positional argument must not be followed by more positional argument as this creates ambiguous specifications.

Sourceval pos_with_default : ?docv:string -> pos:int -> 'a Param.t -> default:'a -> doc:string -> 'a t

A optional positional argument with a default value.

Sourceval pos_all : ?docv:string -> 'a Param.t -> doc:string -> 'a list t

Return the list of all remaining positional arguments.