Core Events¶
The following events are defined by xonsh itself.
on_chdir | on_envvar_change | on_envvar_new |
on_exit | on_post_cmdloop | on_post_init |
on_post_prompt | on_post_rc | on_postcommand |
on_pre_cmdloop | on_pre_prompt | on_pre_rc |
on_precommand | on_transform_command |
Listing¶
on_chdir(olddir: str, newdir: str) -> None
¶
Fires when the current directory is changed for any reason.
on_envvar_change(name: str, oldvalue: Any, newvalue: Any) -> None
¶
Fires after an enviroment variable is changed. Note: Setting envvars inside the handler might cause a recursion until the limit.
on_envvar_new(name: str, value: Any) -> None
¶
Fires after a new enviroment variable is created. Note: Setting envvars inside the handler might cause a recursion until the limit.
on_exit() -> None
¶
Fired after all commands have been executed, before tear-down occurs.
NOTE: All the caveats of the atexit
module also apply to this event.
on_post_cmdloop() -> None
¶
Fired just after the command loop finishes, if it is.
NOTE: All the caveats of the atexit
module also apply to this event.
on_post_init() -> None
¶
Fired after all initialization is finished and we’re ready to do work.
NOTE: This is fired before the wizard is automatically started.
on_postcommand(cmd: str, rtn: int, out: str or None, ts: list) -> None
¶
Fires just after a command is executed. The arguments are the same as history.
on_transform_command(cmd: str) -> str
¶
Fired to request xontribs to transform a command line. Return the transformed command, or the same command if no transformaiton occurs. Only done for interactive sessions.
This may be fired multiple times per command, with other transformers input or output, so design any handlers for this carefully.