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

Allow bat to replace variables on text #2914

Open
patrickelectric opened this issue Mar 25, 2024 · 2 comments
Open

Allow bat to replace variables on text #2914

patrickelectric opened this issue Mar 25, 2024 · 2 comments
Labels
feature-request New feature or request

Comments

@patrickelectric
Copy link

Something like this:

This is your home: ${HOME}

should be replaced automatically by the env variable HOME

@patrickelectric patrickelectric added the feature-request New feature or request label Mar 25, 2024
@keith-hall
Copy link
Collaborator

I personally feel like having this happen automatically would not be desired at all, as it could be highly confusing. Especially when looking at a config file for something which would actually be deployed to a different environment.
Perhaps some wrapper script to pre-process it would suffice?

@eth-p
Copy link
Collaborator

eth-p commented Mar 26, 2024

I'm with @keith-hall on this. Automatically expanding environment variables will likely cause confusion, even in code.

function newTempFile($tmpdir) {
    $file = fopen("${tmpdir}/file.txt", "w");
    if ($file === false) {
        // do something
    }

    return $file;
}

If environment variables were replaced, it would lead the user into thinking the new temporary file is located at /tmp instead of the directory specified as the function parameter.

A preprocessing step would be a better place to do environment variable expansion.

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

No branches or pull requests

3 participants