Skip to main content

Module directive

Module directive 

Source
Expand description

REPL directives

A REPL line starting with : is a framework directive; any other line is an application command. The set of directives is closed for a given version of the crate and described by ReplDirective. An application may rename a directive, change its aliases or its description through the optional directives: section of its configuration, but it can neither add nor disable one.

§Default directives

implementationNameAliasesArguments
repl_helphelph, ?[command]
repl_loadload<path>
repl_quitquitq
repl_exitexit

Names and aliases are written without the leading :; the REPL adds it.

§Overriding a directive

directives:
  - implementation: repl_help
    name: aide
    aliases: [a]
    description: "Afficher l'aide"

An entry replaces the name, the aliases and the description of the directive selected by implementation; aliases defaults to an empty list. Directives without an entry keep their defaults. effective_directives computes the resulting table.

§Validation

The configuration validator rejects:

  • an unknown implementation (already at load time);
  • two entries for the same implementation;
  • an empty name or alias, one containing whitespace, or one starting with :;
  • a name or alias used twice in the effective table, defaults included: an override cannot take q while :quit keeps it as its alias.

Directive names are never compared with command names, since a directive is always typed with its :. Command names and aliases, for their part, may not start with :.

Structs§

DirectiveDefinition
Name, aliases and description of a REPL directive

Enums§

ReplDirective
Framework directive available in the REPL

Functions§

effective_directives
Complete directive table after applying the configuration overrides