Skip to content

Add a new sketch subcommand to retrieve build-related information #2866

Open
@kittaakos

Description

@kittaakos

Describe the request

Please consider adding a new subcommand for sketch to expose certain build-related information, including the build_path of a given sketch.

The primary motivation for this request is to allow clients of the CLI to access information related to the build path without needing to reimplement the CLI's logic for calculating the build folder path or compiling the sketch. The build folder name is derived from the sketch folder path, which can vary across different operating systems and configurations. It's fragile to reimplement it.

For instance, the CLI may generate paths that differ by case sensitivity on Windows (e.g., c:\ vs C:\) or encounter issues with the 8.3 filename convention. Similarly, on macOS, two different paths may point to the same directory due to symlinks.

Proposed Behavior:

  1. The command should return the build path for a sketch, even if it hasn't been compiled yet.
  2. It would be helpful to include metadata about the build, such as contents from build.options.json, if available.

This feature would improve the usability of the Arduino CLI, especially for developers looking to optimize their workflows.

Thank you for considering my request!

Describe the current behavior

It is not possible to retrieve the build_path of the sketch without compiling the sketch.

Arduino CLI version

1.2.0

Operating system

macOS

Operating system version

15.3.1

Additional context

No response

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the nightly build
  • My request contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions