Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interpreter: handling multiple init files #254

Open
katcipis opened this issue Jan 5, 2018 · 2 comments
Open

interpreter: handling multiple init files #254

katcipis opened this issue Jan 5, 2018 · 2 comments

Comments

@katcipis
Copy link
Member

katcipis commented Jan 5, 2018

Today when there is multiple files that matches with possible init files (eg. init and init.sh) we just silently load the first one (which one is it ? I don't know =D). It would be nice to discuss this and get a better behavior.

@ryukinix
Copy link
Member

Hmmm and if we have the both file? Load both? Emacs, for instance, have this feature but I think it's pretty horrible. There are two init files:

  1. ~/.emacsrc
  2. ~/.emacs.d/init.el

However if (1) exists, (2) is not loaded. This can be tricky to understand in the first use of emacs (I need to debug this shit in past and was when I learnt that). I prefer just one case that be right, as $NASHPATH/init.<extension>, our current default.

Do you think that multiple init files can be useful in some way? I just can think being to add some mess to the conf stuff.

@i4ki
Copy link
Collaborator

i4ki commented Mar 12, 2018

Currently, the init file is $NASHPATH/init but it mimics the behavior of the import keyword: if the file without extension does not exists it looks for one with ".sh" extension.

init: https://github.com/NeowayLabs/nash/blob/master/cmd/nash/cli.go#L75-L88
import keyword: https://github.com/NeowayLabs/nash/blob/master/internal/sh/shell.go#L977-L989

Instead of two codes to handle this, we can the cli just execute import $NASHPATH+"/init".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants