-
Notifications
You must be signed in to change notification settings - Fork 3
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 load_config to allow it to read from stdin #77
base: master
Are you sure you want to change the base?
Conversation
Adds the ability to read INI style conifigs from stdin and switches to a continious read operation rather than multiple reads
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' |
There was a problem hiding this comment.
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.
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
There was a problem hiding this comment.
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}" |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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 ...
Adds the ability to read INI style conifigs from stdin and switches to a
continious read operation rather than multiple reads