Skip to content

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Jul 30, 2024

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull 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?

Adds the --config-dir global flag that overrides the default data directory. This command can be used with config init --dest-dir to work in an "isolated" environment.

What is the current behavior?

What is the new behavior?

$ arduino-cli config init --dest-dir test --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
Config file written to: /home/cmaglie/test/arduino-cli.yaml
$ cat test/arduino-cli.yaml 
board_manager:
    additional_urls:
        - https://arduino.esp8266.com/stable/package_esp8266com_index.json
$ arduino-cli core update-index --config-dir test/
Downloading index: library_index.tar.bz2 downloaded                                                                                                                                    
Downloading index: package_index.tar.bz2 downloaded                                                                                                                                    
Downloading index: package_esp8266com_index.json downloaded                                                                                                                            
Downloading missing tool builtin:serial-discovery@1.4.1...
builtin:serial-discovery@1.4.1 downloaded                                                                                                                                              
Installing builtin:serial-discovery@1.4.1...
Skipping tool configuration....
builtin:serial-discovery@1.4.1 installed
Downloading missing tool builtin:serial-monitor@0.14.1...
builtin:serial-monitor@0.14.1 downloaded                                                                                                                                               
Installing builtin:serial-monitor@0.14.1...
Skipping tool configuration....
builtin:serial-monitor@0.14.1 installed
Downloading missing tool builtin:ctags@5.8-arduino11...
builtin:ctags@5.8-arduino11 downloaded                                                                                                                                                 
Installing builtin:ctags@5.8-arduino11...
Skipping tool configuration....
builtin:ctags@5.8-arduino11 installed
Downloading missing tool builtin:dfu-discovery@0.1.2...
builtin:dfu-discovery@0.1.2 downloaded                                                                                                                                                 
Installing builtin:dfu-discovery@0.1.2...
Skipping tool configuration....
builtin:dfu-discovery@0.1.2 installed
Downloading missing tool builtin:mdns-discovery@1.0.9...
builtin:mdns-discovery@1.0.9 downloaded                                                                                                                                                
Installing builtin:mdns-discovery@1.0.9...
Skipping tool configuration....
builtin:mdns-discovery@1.0.9 installed
Sto scaricando l'indice: package_index.tar.bz2 scaricato                                                                                                                               
Sto scaricando l'indice: package_esp8266com_index.json scaricato                                                                                                                       
$ ls -l test/
totale 40320
-rw-r--r-- 1 cmaglie cmaglie      111 lug 30 20:43 arduino-cli.yaml
-rw-r--r-- 1 cmaglie cmaglie      108 lug 30 20:43 inventory.yaml
-rw-r--r-- 1 cmaglie cmaglie 40052066 lug 30 20:43 library_index.json
-rw-r--r-- 1 cmaglie cmaglie      566 lug 30 20:43 library_index.json.sig
-rw-r--r-- 1 cmaglie cmaglie   181534 lug 30 20:43 package_esp8266com_index.json
-rw-r--r-- 1 cmaglie cmaglie  1012551 lug 30 20:43 package_index.json
-rw-r--r-- 1 cmaglie cmaglie      566 lug 30 20:43 package_index.json.sig
drwxr-xr-x 3 cmaglie cmaglie     4096 lug 30 20:43 packages
drwxr-xr-x 3 cmaglie cmaglie     4096 lug 30 20:43 staging
drwxr-xr-x 2 cmaglie cmaglie     4096 lug 30 20:43 tmp
$ 

Does this PR introduce a breaking change, and is titled accordingly?

Other information

Fix #2533
cc @pillo79

@cmaglie cmaglie added type: enhancement Proposed improvement topic: CLI Related to the command line interface labels Jul 30, 2024
@cmaglie cmaglie self-assigned this Jul 30, 2024
Copy link

codecov bot commented Jul 30, 2024

Codecov Report

Attention: Patch coverage is 88.46154% with 3 lines in your changes missing coverage. Please review.

Project coverage is 70.25%. Comparing base (b8c927b) to head (535e1da).
Report is 2 commits behind head on master.

Files Patch % Lines
internal/cli/configuration/configuration.go 81.25% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2677      +/-   ##
==========================================
+ Coverage   70.22%   70.25%   +0.02%     
==========================================
  Files         222      222              
  Lines       21348    21365      +17     
==========================================
+ Hits        14992    15010      +18     
+ Misses       5177     5176       -1     
  Partials     1179     1179              
Flag Coverage Δ
unit 70.25% <88.46%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cmaglie cmaglie force-pushed the add-config-dir-flag branch from 3768f43 to 535e1da Compare July 30, 2024 22:34
@pillo79
Copy link
Contributor

pillo79 commented Aug 1, 2024

Thank you for this! 🚀
I think the use case that allows to easily do sandbox tests should also be mentioned in the documentation, but I'm not sure how to make that happen 🙂

@cmaglie cmaglie merged commit a353f86 into arduino:master Aug 2, 2024
@cmaglie cmaglie deleted the add-config-dir-flag branch August 2, 2024 13:06
@cmaglie
Copy link
Member Author

cmaglie commented Aug 2, 2024

Thank you for this! 🚀 I think the use case that allows to easily do sandbox tests should also be mentioned in the documentation, but I'm not sure how to make that happen 🙂

Just open a PR with the desired changes in docs/... 😃

@cmaglie cmaglie added the conclusion: resolved Issue was resolved label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: CLI Related to the command line interface type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confused by the config init --dest-dir functionality
3 participants