Skip to content

interpreter: handling multiple init files #254

Open

Description

@katcipis

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.

Activity

  1. ryukinix commented on Mar 11, 2018

    @ryukinix
    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.

  2. i4ki commented on Mar 12, 2018

    @i4ki
    Collaborator

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions