Skip to content
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

Add command to generate code for single DBC #292

Closed

Conversation

bertaveira
Copy link

In some applications I am facing, some of the DBCs in the same directory are not needed to be generated and contain things that actually make the generation of go code crash (non standard or Einride compliant). I cannot change those DBCs that are non standard (since they are used elsewhere) but I also would like to kept them in that folder since they are used by other things (git submodule used by many other projects).

I propose this new command generate-single where you specify directly the DBC file and the output file. This gives more freedom to only generate for the desired DBC files without changing the existing generate command. It also allows to output each file to a different folder and even choose a different output name from the default if so desired by the user.

@Jassob
Copy link
Member

Jassob commented Aug 12, 2024

Thank you for your suggestion @bertaveira! However, as a counter-proposal, if we changed the generate command to accept either a directory or file, would that work for you?

I would prefer to keep the UX as minimal as possible and as far as I can see, the change is rather small and easy on my side.

@bertaveira
Copy link
Author

@Jassob Sounds good to me. I noticed later how it was done in the lint command so I guess it would also be more consistent to that command. Should I do that or do you want to do it?

I also noticed I had to add filepath.ToSlash() in the generate function otherwise when running in windows with paths (which the seperator is a backslash) it would try to write the comment in the first lines of the generated go code with a backslash which caused it to fail to write. Not sure if that should be a seperate issue ticket but just thought it would be good to know

@Jassob
Copy link
Member

Jassob commented Aug 13, 2024

@Jassob Sounds good to me. I noticed later how it was done in the lint command so I guess it would also be more consistent to that command. Should I do that or do you want to do it?

I also noticed I had to add filepath.ToSlash() in the generate function otherwise when running in windows with paths (which the seperator is a backslash) it would try to write the comment in the first lines of the generated go code with a backslash which caused it to fail to write. Not sure if that should be a seperate issue ticket but just thought it would be good to know

I have done the changes, see #295. If it works for your purpose I will happily merge it 👌

@Jassob
Copy link
Member

Jassob commented Sep 29, 2024

Closing this in favor for #295

@Jassob Jassob closed this Sep 29, 2024
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.

2 participants