arduino-cli
arduino-cli copied to clipboard
Enable creating new sketches from a template directory
Please check if the PR fulfills these requirements
- [X] The PR has no duplicates (please search among the Pull Requests before creating one)
- [X] The PR follows our contributing guidelines
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
- [ ]
UPGRADING.mdhas been updated with a migration guide (for breaking changes) - [ ]
configuration.schema.jsonupdated if new parameters are added.
What kind of change does this PR introduce?
Implements feature request in #2239, although instead of implementing a single "blueprint" file, allows for an entire template directory.
What is the current behavior?
Running arduino-cli sketch new MySketch will create a MySketch/MySketch.ino file.
What is the new behavior?
If directories.template is not set, the behavior is the same as before.
If it is set, running arduino-cli sketch new MySketch will copy the directories.template directory to create the MySketch directory.
Does this PR introduce a breaking change, and is titled accordingly?
This isn't a breaking change.
Other Information
Tests/docs haven't been written. Putting this up as a draft to get initial feedback before putting in more effort. One question how to handle setting sketchMainFilePath. Should we rename some file in the template directory to MySketch.ino? Or just pick a .ino from the directory (ideally there's only one) and return that from the RPC call?
@cmaglie thanks for the feedback! I've addressed your comments and rebased. If the template directory is /path/to/template, it's now required that /path/to/template.ino exists, and it will be renamed to the actual main sketch file.
If this general approach looks correct to you, I'll start working on the tests/docs when I get some time.
Looks good, thanks, go on!
Hello @gsingh93 did you had time to continue? :smile:
Sorry, I haven't had time to work on this in a while. Someone else can pick it up from here, or it could be closed for now and I'll reopen if I ever come back to it. Either way is fine.