-
Notifications
You must be signed in to change notification settings - Fork 1
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
Tried to add refinements for redefining identifiers #6
base: main
Are you sure you want to change the base?
Conversation
Hey @LyubomirT, thank you for your contribution to Sophie! I just did a quick look through your changes. Here are general comments on the pull request: Ready to merge:
This was well done, thanks! Please see the
This was an greatly needed enhancement! I deal with a very niche editing environment so didn't realize how my text files end up looking like 😅 . I think I may need to start opening up to industry-wide accepted editors. Needs more review:
Can you please leave a comment in the GitHub code review on where Sophie can now parse a chain on a single line? It would make it much easier for me to find since the whitespace fixes have thrown off the diff.
This above, is |
Finally, if you only want to merge the whitespace organization and the special empty syntax for #3, then I can take that alone if the rest of #3 is not complete. Regardless of how much you are contributing to |
Got it, I'll start working on this update right away, thanks for the information. |
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 added comments ( # Handle chaining of multiple filters on a single line
) so it will be easy to find where that is done
@ma-ilsi Updated the |
I have run the workflow for basic testing. Please have a look at the results in the checks. I know the output may seem very confusing because of the differences between each shell. But this is the process of making sure a shell script passes on all major operating systems and is POSIX compliant. Suggestions:
|
I'm truly sorry for this, I've made some dumb mistakes while updating the code. Fixing them... EDIT: Almost done with debugging, will be pushing the update soon. |
@ma-ilsi I fixed the glitches, should be working properly now. |
sophie.sh
Outdated
|
||
if [ "$curr_command" = "filecabinet" ]; then | ||
# Identifier | ||
cut_count=$(expr "$line" : '[^=]*="[^"]*"') |
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.
Here we are supposed to match the identifier and the very first opening bracket[
. But this regex is going beyond that.
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.
😓 My bad, I'm sorry.
Changed the line to:
cut_count=$(expr "$line" : '[^[]*\[')
I hope this is what you're looking for.
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.
No worries, no need to apologize! I will see how it does locally.
@LyubomirT Thank you for your patience! I would like to get your whitespace changes merged but the refinements code is still not mature. Have a look at issue #8 with a fresh branch off of The refinement changes might take a while to process. I would recommend getting the whitespace mentioned in #8 done separately and then opening a brand new pull for the refinements step-by-step. Try implementing just the empty special |
fi | ||
|
||
# Remove old | ||
file_cabinet=$(printf "$file_cabinet" | awk -v id="__SOPHIE_IDENTIFIER$curr_identifier=" '!index($0, id)') |
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.
Do you think we should add awk
over sed
? I think having a few rare instances of awk
throws off simplicity and consistency. I was trying to stick to the most basic utils that almost every developer would know: sed
, grep
, cut
, tr
are simple to learn and enough for all the parsing needs.
Summary of Changes
In this code modification, I have implemented the following features and improvements:
[ ]
(definitions) to refine a previous definition in thefilecabinet
andnotices
sections of the configuration.[ ]
to represent resetting or emptying the previous definition.additive refinements
andsubtractive refinements
for more flexible filtering.Resolved Issues
This pull request addresses the following issues: #3
Testing
All changes made in this pull request have successfully passed local testing. The existing tests in the codebase have been executed to ensure that the new features and improvements do not introduce any regressions.