Module Cam_commands


module Cam_commands: sig .. end
Commands management

type command = string array -> unit 

type command_desc = {
   com_name : string;
   com_args : string array;
   com_more_args : string option;
   com_f : command;
}
val register : ?table:(string, command_desc) Hashtbl.t ->
?replace:bool -> command_desc -> unit
register command registers the given command.
val register_before : ?table:(string, command_desc) Hashtbl.t ->
command_desc -> unit
register_before command replace the previous command with the same name (if any) by a function calling the given command (with the same name) then the function assciated to the previous command. The same arguments are passed to the two functions. If the first command fails, the second is not called. If there is no previous command registered with the same name, the function is similar to Cam_commands.register.
val register_after : ?table:(string, command_desc) Hashtbl.t ->
command_desc -> unit
Same as Cam_commands.register_before but the function of the given command is called after the previous command registered with the same name (if any).
val get_com : ?table:(string, command_desc) Hashtbl.t ->
string -> command_desc
Get the command with the given name.
Raises Not_found if the command was not found.
table : can be used to specify an alternative command table.
val get_com_or_fail : ?table:(string, command_desc) Hashtbl.t ->
string -> command_desc
Same as Cam_commands.get_com but raise a Failure exception with a comprehensive message when the command is not found.
val string_to_argv : string -> string array
val argv_to_string : string array -> string
val launch_command : ?history:bool ->
?table:(string, command_desc) Hashtbl.t ->
string -> string array -> unit
val same_previous_command : unit -> bool
Return true if is currently executed command is the same as the previous command one. This can be used in commands to have a different behaviour when the same command is triggered mutliple time.
val ask_launch_command : ?history:bool ->
?table:(string, command_desc) Hashtbl.t ->
?width:int -> string -> string array -> unit
val eval_command : ?history:bool ->
?table:(string, command_desc) Hashtbl.t -> string -> unit
val available_command_names : ?table:(string, command_desc) Hashtbl.t -> unit -> string list
val unit_com : string -> (unit -> unit) -> command_desc
Create a simple command with a function taking no argument.
val create_com : string ->
?more:string ->
string array -> command -> command_desc
Convenient function to create a command.

Global variables


val set_global : string -> string -> unit
set_global name value associates the given value to the given name.
val get_global : string -> string
get_global name returns the value associatd to name.
Raises Not_found if the variable has no value.
val safe_get_global : string -> string
safe_get_global name works as Cam_commands.get_global but returns an empty string "" if no value is associated to the given name.