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

Fix chamber env and chamber export -f dotenv #385

Merged
merged 7 commits into from
May 12, 2023
Merged

Commits on May 11, 2023

  1. Fix & refactor env and export -f dotenv

    This was reported in #366: `chamber` made no effort
    to sanitize keys for either of these commands or formats, which can
    result in invalid variable names being used for both of these output
    formats.
    
    Some of the construction of these formats have now been unified, with
    an optional boolean flag for `env` to preserve key case -- note that
    keys will still be sanitized, they just won't be converted to
    uppercase. Since `export -f dotenv` rewrites values using escape
    characters, I've made the choice to continue allowing `export -f
    dotenv` to always convert keys to uppercase.
    mckern committed May 11, 2023
    Configuration menu
    Copy the full SHA
    e2ba722 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c58744b View commit details
    Browse the repository at this point in the history
  3. Don't sort env or export flags

    This ensures that `--help` comes after our defined flags, and looks a
    little more consistent and professional. Might add it to other flags
    in a separate PR but this is a good start.
    mckern committed May 11, 2023
    Configuration menu
    Copy the full SHA
    7fab801 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5ab432a View commit details
    Browse the repository at this point in the history
  5. Simplify env.sortedKeys() looping

    Also added a note about sort.Strings() being case-sensitive.
    mckern committed May 11, 2023
    Configuration menu
    Copy the full SHA
    f9ad760 View commit details
    Browse the repository at this point in the history
  6. Fix my own typo

    mckern committed May 11, 2023
    Configuration menu
    Copy the full SHA
    2d6e497 View commit details
    Browse the repository at this point in the history
  7. Oh right, slice initialization is weird.

    Since I switched to using append() for env.sortedKeys() instead of
    using an iterator, it's easier to initialize an empty slice and let it
    reslice as needed.
    mckern committed May 11, 2023
    Configuration menu
    Copy the full SHA
    7674fa9 View commit details
    Browse the repository at this point in the history