arduino-cli icon indicating copy to clipboard operation
arduino-cli copied to clipboard

Enable creating new sketches from a template directory

Open gsingh93 opened this issue 2 years ago • 4 comments
trafficstars

Please check if the PR fulfills these requirements

See how to contribute

  • [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.md has been updated with a migration guide (for breaking changes)
  • [ ] configuration.schema.json updated 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?

gsingh93 avatar Oct 08 '23 12:10 gsingh93

@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.

gsingh93 avatar Oct 19 '23 11:10 gsingh93

Looks good, thanks, go on!

cmaglie avatar Oct 23 '23 15:10 cmaglie

Hello @gsingh93 did you had time to continue? :smile:

umbynos avatar Jan 23 '24 11:01 umbynos

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.

gsingh93 avatar Jan 27 '24 01:01 gsingh93