Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enable creating new sketches from a template directory#2359

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
gsingh93 wants to merge4 commits intoarduino:master
base:master
Choose a base branch
Loading
fromgsingh93:template

Conversation

@gsingh93
Copy link

@gsingh93gsingh93 commentedOct 8, 2023
edited
Loading

Please check if the PR fulfills these requirements

Seehow to contribute

  • The PR has no duplicates (please search among thePull Requests
    before creating one)
  • 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?

Runningarduino-cli sketch new MySketch will create aMySketch/MySketch.ino file.

What is the new behavior?

Ifdirectories.template is not set, the behavior is the same as before.

If it is set, runningarduino-cli sketch new MySketch will copy thedirectories.template directory to create theMySketch directory.

Does this PR introduce a breaking change, and istitled 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 settingsketchMainFilePath. Should we rename some file in the template directory toMySketch.ino? Or just pick a .ino from the directory (ideally there's only one) and return that from the RPC call?

@per1234per1234 added type: enhancementProposed improvement topic: codeRelated to content of the project itself labelsOct 8, 2023
Copy link
Member

@cmagliecmaglie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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?

mmmhh... It's a bit more convoluted than expected, we should consider these factors:

  1. A sketch may be composed of many files
  2. Themain sketch file is the .ino file that is named exactly as the containing folder
  3. We should copy the entire "template" sketch folder into the new user-requested sketch folder
  4. In the new folder we must rename the template-main-sketch file to match the new folder name.

So let's recap with an example:

Suppose we configure the sketch template to point to/path/to/sketch/template, that has the following content:

/path/to/sketch/template/another_file.ino/path/to/sketch/template/template.ino      <--- MAIN FILE/path/to/sketch/template/passwords.h

if we runarduino-cli sketch new mysketchbook/newsketch, the expected result is:

./mysketchbook/newsketch/another_file.ino./mysketchbook/newsketch/newsketch.ino      <--- MAIN FILE./mysketchbook/newsketch/passwords.h

The most notable part here is thattemplate.ino has been renamednewsketch.ino because it's the main file.

@gsingh93
Copy link
Author

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

@cmaglie
Copy link
Member

Looks good, thanks, go on!

@umbynosumbynos linked an issueNov 14, 2023 that may beclosed by this pull request
3 tasks
@umbynos
Copy link
Contributor

Hello@gsingh93 did you had time to continue? 😄

@umbynosumbynos added the status: waiting for informationMore information must be provided before work can proceed labelJan 23, 2024
@gsingh93
Copy link
Author

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.

umbynos reacted with thumbs up emoji

@umbynosumbynos removed the status: waiting for informationMore information must be provided before work can proceed labelJan 29, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@cmagliecmagliecmaglie left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

topic: codeRelated to content of the project itselftype: enhancementProposed improvement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Allow customizing the new sketch template

4 participants

@gsingh93@cmaglie@umbynos@per1234

[8]ページ先頭

©2009-2025 Movatter.jp