Conversation
|
@sporksmith @robgjansen do you have have an idea to improve the |
Typically for this kind of usage you want to read until end-of-file, rather than looking for a specific "end" content pattern. You might be able to use |
|
Alternatively we might be able to just pass "/dev/stdin" as the filename to the existing helper function, but I'm not sure how portable that is. |
|
In case we read until the EOF we have to consider that if a user enters the schema by copy/past in stdin, he also has to send a CTRL+D. It's cleaner in the code but I don't find it really "user friendly" even if I will be surprised if someone does a copy/past of a config file. |
|
Reading until EOF is the convention used by most command-line utilities that read from stdin. I agree it can be a little confusing for someone new to the command-line, but I don't think it's worth breaking convention. Typically the user would be using shell redirection or a pipe to send the contents in anyway, rather than copy-pasting. e.g. |
|
It seems that I will add tests now except if you have any other idea for cleaning. :) |
| file = utility_getFileContents(fileName->str); | ||
| // Read config from file or stdin | ||
| if (0 == g_strcmp0("-", fileName->str)) { | ||
| file = utility_getFileContents("/dev/stdin"); |
There was a problem hiding this comment.
Maybe could I remove this condition by relocating /dev/stdin string in the master->options hydration ?
There was a problem hiding this comment.
I don't follow what you're suggesting, but this looks fine as is.
|
I would like to add some tests. I thought in the |
Codecov Report
@@ Coverage Diff @@
## dev #895 +/- ##
==========================================
- Coverage 50.41% 50.36% -0.06%
==========================================
Files 124 125 +1
Lines 16925 16929 +4
Branches 4326 4327 +1
==========================================
- Hits 8533 8526 -7
- Misses 5663 5677 +14
+ Partials 2729 2726 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Is the idea to move the tests currently in the config directory to a new subdirectory |
a80ef1a to
c43e9a1
Compare
| file = utility_getFileContents(fileName->str); | ||
| // Read config from file or stdin | ||
| if (0 == g_strcmp0("-", fileName->str)) { | ||
| file = utility_getFileContents("/dev/stdin"); |
There was a problem hiding this comment.
I don't follow what you're suggesting, but this looks fine as is.
|
@robgjansen LMK whether you want to review; otherwise I can go ahead and (squash) and merge |
No description provided.