Cling startup scripts support

Many interpreters support startup script being executed before command prompt.
I propose to add the following features similar to python ($PYTHONSTARTUP), bash(.bashrc, .bash_profile), zsh (.zprofile, .zshrc) :

  1. If the file .cling_profile exists, cling binary executes it after launch and right before doing “real work” (showing command promt or executing scripts from argv).

  2. If the file .clingrc exists, cling execute it after .cling_profile and before the “real work”. However, only do this when cling is invoked as in the interactive mode (the mode with a command prompt).

  3. Search order for .cling_profile and .clingrc:

    1. ${CLING_HOME} environment variable (or CLING_ROOT ? please suggest names)
    2. ${XDG_CONFIG_HOME}/cling/ (please refer to XDG Base Directory Specification . As a new forum user I cannot post links here)
    3. ${HOME}/.config/cling/
    4. ${HOME}/

P.S. I have implemented the above features and used them on my local cling. I would like to collect some feedback before creating a pull request.

The PR is created. PR #11262 . Unfortunately as a new forum user I cannot post the hyperlink here.

Thank you @jiangyilism – discussion continues at [cling] Startup script support by jiangyilism · Pull Request #11262 · root-project/root · GitHub , I guess :slight_smile:

Cheers,
Enrico

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.