Skip to content

Conversation

@antevens
Copy link
Contributor

Adds the ability to read INI style conifigs from stdin and switches to a
continious read operation rather than multiple reads

Adds the ability to read INI style conifigs from stdin and switches to a
continious read operation rather than multiple reads
@antevens antevens requested a review from hrpatel May 27, 2020 16:23
while read -r line; do
# If first argument is a filename read it and pass it to the function
if [ -f "${1:-}" ]; then
print_settings='false'
Copy link
Member

Choose a reason for hiding this comment

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

Should we allow flexibility here to allow printing?

E.g.

Suggested change
print_settings='false'
print_settings="${print_settings:-false}"

So we can do something like:

print_settings=true load_config  config foo
Loaded config parameter foo with value of 'bar'
foo=bar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do .. and we don't.

Print Setting will actually cause issues because we're allowing piping but it does not matter because that particular case will recurse so it will pick up the setting on the second run :)

color_echo red "No config filename provided or data on stdin, exiting"
return 1
else
print_settings="${print_settings:-true}"
Copy link
Member

Choose a reason for hiding this comment

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

I can't figure out when we ever reach this case...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason my reply is missing, think about the function being called iteratively ...

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.

3 participants