bugGNU gettext - Bugs: bug #63948, envsubst: Support option -s for...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #63948: envsubst: Support option -s for "strict"

Submitter:  Thomas Güttler <guettli>
Submitted:  Mon 20 Mar 2023 01:27:27 PM UTC
   
 
Category:  End-user / runtime Severity:  3 - Normal
Item Group:  None Status:  Not a Bug
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Tue 21 Mar 2023 08:55:54 AM UTC, comment #2: 


original submission:

> It would be nice, if envsubst would support the `-s` (strict) option. This option makes the command fail, if a variable is not existing in the list of environment variables.
>
> Related tools support this. For example:
>
> https://github.com/kreuzwerker/envplate
>
>


envplate does not support fallbacks like `${missing=default}`.

If someone is here looking for an envsubst tool which supports fallbacks and fail-on-missing, then this tools looks good:

https://github.com/a8m/envsubst

Thomas Güttler <guettli>
Mon 20 Mar 2023 03:37:41 PM UTC, comment #1: 

The wish is not useful for the purpose of envsubst.

envsubst is meant as an auxiliary program for implementing eval_gettext, so that the user can replace, in a shell script

echo "Hello $name, I greet you"

with

eval_gettext "Hello \$name, I greet you"


If, at this point of execution in the shell script, the environment variable 'name' has no value, an empty value will be used in the shell code with 'echo'; therefore an empty value is also what needs to be used in the shell code with 'eval_gettext' — and that's what envsubst does.

If a shell script wants to verify that a certain environment variable is set, it can do so prior to the shown line. This kind of validation is orthogonal to internationalization; I see no reason why it should be made a built-in feature of the internationalization.

Bruno Haible <haible>
Group administrator
Mon 20 Mar 2023 01:27:27 PM UTC, original submission:  

It would be nice, if envsubst would support the `-s` (strict) option. This option makes the command fail, if a variable is not existing in the list of environment variables.

Related tools support this. For example:

https://github.com/kreuzwerker/envplate


Thomas Güttler <guettli>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by guettli (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-03-20 haible CategoryProgrammer tools End-user / runtime
        StatusNone Not a Bug
        Assigned toNone haible
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code