Core Events

The following events are defined by xonsh itself.

on_chdir on_exit on_post_cmdloop
on_post_init on_post_rc on_postcommand
on_pre_cmdloop on_pre_rc on_precommand

Listing

on_chdir(olddir: str, newdir: str) -> None

Fires when the current directory is changed for any reason.


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_post_rc() -> None

Fired just after rc files are loaded, if they are.


on_postcommand(cmd: str, rtn: int, out: str or None, ts: list) -> None

Fires just after a command is executed.


on_pre_cmdloop() -> None

Fired just before the command loop is started, if it is.


on_pre_rc() -> None

Fired just before rc files are loaded, if they are.


on_precommand(cmd: str) -> str

Fires just before a command is executed.