-
Notifications
You must be signed in to change notification settings - Fork 607
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
feat: Added BOM capability for output files (#1267) #1274
base: master
Are you sure you want to change the base?
feat: Added BOM capability for output files (#1267) #1274
Conversation
alvaro-osvaldo-tm
commented
Feb 9, 2025
- Added the '--add-bom' parameter for almost utilities
- Added the '--add-bom' parameter for almost utilities Signed-off-by: Álvaro Osvaldo <[email protected]>
ImplementationImplemented the feature to optionality add UTF-8 Byte Order Mark (BOM) into output content in all utilities, Solution
Tests
Checklist
Considerations
References
|
Signed-off-by: Álvaro Osvaldo <[email protected]>
@@ -245,6 +248,8 @@ def _init_common_parser(self): | |||
help='Insert a column of line numbers at the front of the output. Useful when piping to grep or as a ' | |||
'simple primary key.') | |||
|
|||
AddBOM.argument(self.argparser,self) |
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.
Please conform to the existing code, instead of introducing an entirely different code organization pattern.
@@ -134,6 +135,8 @@ def run(self): | |||
if 'f' not in self.override_flags: | |||
self.input_file = self._open_input_file(self.args.input_path) | |||
|
|||
AddBOM.run(self.output_file, self.args) |
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.
Just inline the 2 lines of code here, instead of creating a new 54-line file:
if getattr(self.args, 'add_bom', False):
self.output_file.buffer.write(BOM_UTF8)
And of course do from codecs import BOM_UTF8
with the other imports.