Re: [PATCH v2 5/8] builtins/source: parse the -i option
From:
Matheus Afonso Martins Moreira
Subject:
Re: [PATCH v2 5/8] builtins/source: parse the -i option
Date:
Tue, 14 May 2024 22:08:49 +0000
I agree that it is not strictly necessary.
It could be implemented without an option.
I personally have no objections to that solution.
My arguments for the option are the following:
- It enhances compatibility
Without the option, source behaves exactly as before.
Existing scripts will work exactly as before even if
the user has defined BASH_SOURCE_PATH.
I paid special attention to the posixly correct behavior.
- It's opt in
Users will have to explicitly choose to use
the new behavior of source, preventing errors.
- It simplifies and reduces cognitive load
Passing -i means only the directories in
BASH_SOURCE_PATH will be searched,
and no other direcrories. Easy to understand.
- It's clear and explicit
Passing -i makes it explicit to anyone
reading the scripts that they were written
with this new behavior in mind.
-- Matheus