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

Supplier choices are invalid when using external config dir #19

Open
QuadratClown opened this issue Mar 5, 2024 · 7 comments
Open

Supplier choices are invalid when using external config dir #19

QuadratClown opened this issue Mar 5, 2024 · 7 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@QuadratClown
Copy link

When using supplier constrained input flags like -s or -o together with the -c flag, the cli will not use the provided config dir when deciding which suppliers are valid choices.

How to reproduce

  • do not set up the default config dir
  • set up the config in a local dir like inventree-part-import
    • set up a supplier, e.g. 'mouser'

From config folder, run:

inventree-part-import -c $pwd -o mouser <arbitraryPart>

Expected behaviour

Use config dir provided with -c for supplier choices

Real behaviour

Error: Invalid value for '-o' / '--only': 'mouser' is not one of .
@30350n
Copy link
Owner

30350n commented Mar 5, 2024

Easiest way to fix this would be to simply also configure those suppliers in the default configuration. Alternatively you could also just use the default configuration directory, I mainly implemented the -c option to be able to quickly test things with different configurations.

@30350n
Copy link
Owner

30350n commented Mar 5, 2024

Fixing this properly probably won't be that easy, because the checking isn't actually done by me, but by click so some restructuring would be required (the checking would have to be disabled and done manually).

@30350n 30350n self-assigned this Mar 5, 2024
@30350n 30350n added the bug Something isn't working label Mar 5, 2024
@30350n 30350n removed their assignment Mar 5, 2024
@QuadratClown
Copy link
Author

Thanks for the quick answer. An alternative way could be to make the default location configurable. Not sure how hard that is with click.

The whole thing is by no means a show stopper anyway, it's just not quite obvious where the error is coming from when not yet familiar with the inner workings of the cli.

@30350n
Copy link
Owner

30350n commented Mar 5, 2024

No problem! Yeah the cause of the error is somewhat opaque.
Any particular reason why you aren't just using the default directory btw?

@QuadratClown
Copy link
Author

I'm using multiple devices with inventree and want to sync the config across them. On windows for example, the default folder is in AppData/Local, which I really dislike using for a purpose like this. Usually, I have just have a scripts folder that contain one folder per script with all necessary configs that I can just sync directly, platform independently.

@30350n
Copy link
Owner

30350n commented Mar 5, 2024

Ah okay, well I'm just using whatever platformdirs.user_config_dir spits out. You could also try to symlink your custom folder into the default location. Pretty sure that should work too.

@QuadratClown
Copy link
Author

The symlink approach is what I'm using for Kicad, guess then for here as well :) Thanks for your time!

@30350n 30350n added the wontfix This will not be worked on label Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants