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

Expand environmental variables in sshOpts #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nrdxp
Copy link
Contributor

@nrdxp nrdxp commented Aug 10, 2021

For now only bracket style expansion is enabled, i.e. ${MY_VAR}. I had issues with expanding $MY_VAR in a path string, and so excluded that usecase to avoid errors. One can specify brackets in a Nix string by escaping the $, e.g. "\${NOT_EXPANDED_BY_NIX}".

This doesn't work in '' stype strings and requires a bit more magic:
''${"\${NOT_EXPANDED_BY_NIX}"}''
#116 (comment)

nrdxp added a commit to input-output-hk/bitte-cli that referenced this pull request Aug 10, 2021
Copy link
Contributor

@notgne2 notgne2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I would like to know more about the issues with the prefix style

@balsoft
Copy link
Member

balsoft commented Aug 11, 2021

This doesn't work in '' stype strings and requires a bit more magic:
''${"${NOT_EXPANDED_BY_NIX}"}''

Actually, just

nix-repl> ''''${NOT_EXPANDED_BY_NIX}''
"${NOT_EXPANDED_BY_NIX}"

@nrdxp
Copy link
Contributor Author

nrdxp commented Aug 11, 2021

@notgne2, it may just be the library I used, but I have a shell that detects the flake root directory using git rev-parse --show-toplevel when trying to set just "$FLAKE_ROOT/path/to/key" it expanded to an empty string somehow 🤷

There is probably a similar crate, or maybe I could look at the source, and just reimplement a more minimal version or something.

@balsoft, thanks for the tip!

@blaggacao
Copy link
Contributor

blaggacao commented Aug 11, 2021

Maybe this function or part of it can also be hammered into shape to be useful for parsing the cli string into a Vector via the parse(try_from_str = parse_key_val) attribute.

That's the last piece missing (on my todo list) for homogenization of data structures.

Can we merge?

@blaggacao
Copy link
Contributor

Can you merge?

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

Successfully merging this pull request may close these issues.

4 participants