Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equals sign in command breaks --libraries flag #1992

Closed
3 tasks done
GKStretton opened this issue Nov 26, 2022 · 4 comments
Closed
3 tasks done

Equals sign in command breaks --libraries flag #1992

GKStretton opened this issue Nov 26, 2022 · 4 comments
Labels
conclusion: invalid Issue/PR not valid type: imperfection Perceived defect in any part of project

Comments

@GKStretton
Copy link

Describe the problem

The following command fails to build because it can't see the libraries installed

arduino-cli compile --fqbn arduino:avr:mega --libraries=~/Arduino/libraries --output-dir ./build .

The following command builds correctly

arduino-cli compile --fqbn arduino:avr:mega --libraries ~/Arduino/libraries --output-dir ./build .

Note the only difference is the equals sign

To reproduce

Run

arduino-cli compile --fqbn arduino:avr:mega --libraries=~/Arduino/libraries --output-dir ./build .

Or similar for any sketch that includes a library in the Arduino/libraries folder. Then change the equals sign to a space for it to work

Expected behavior

I would expect it to work with the equals sign, equals sign is usually supported by commandline tools

Arduino CLI version

0.29.0

Operating system

Linux

Operating system version

Debian 11 x86_64, kernel 5.10.0-19-amd64

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details
@GKStretton GKStretton added the type: imperfection Perceived defect in any part of project label Nov 26, 2022
@lluiscampos
Copy link
Contributor

The problem is not the = sign itself, but the fact that with it, the ~ symbol does not get expanded to your home directory. For example if you run with --libraries=/home/something/Arduino/libraries or --libraries=$HOME/Arduino/libraries it should work just fine.

I would like to help fixing this issue but I don't really know at which level it should be fixed. Is this something to be fixed when parsing the arguments with cobra or later on in LibrariesLoader? Or is it a cobra issue? (it seems related to spf13/cobra#1577)

If someone from Arduino has some guidance I'd be happy to contribute 😃

@umbynos
Copy link
Contributor

umbynos commented May 29, 2023

We tried this:

$ echo --libraries=~/Arduino
--libraries=~/Arduino
$ echo --libraries ~/Arduino
--libraries /home/megabug/Arduino

we used bash on linux.

The substitution of the ~ is a duty of the shell. So I think there is noting we can do on the CLI side. Also ~ is not available on Windows, so there is no point in doing the substitution inside the CLI.

@umbynos umbynos closed this as completed May 29, 2023
@lluiscampos
Copy link
Contributor

lluiscampos commented May 30, 2023

Exactly! I agree with closing this issue.

According to bash docs the tilde only gets expanded when it is at the start of a word. So when bash sees a token like something=~something will not expand it.

@GKStretton
Copy link
Author

Ah, that makes sense - thanks for explaining!

@cmaglie cmaglie added the conclusion: invalid Issue/PR not valid label Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: invalid Issue/PR not valid type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

4 participants