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

Ability to add custom options/flags to existing CLI commands #2567

Closed
bartkl opened this issue May 18, 2017 · 3 comments
Closed

Ability to add custom options/flags to existing CLI commands #2567

bartkl opened this issue May 18, 2017 · 3 comments
Labels
needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature."

Comments

@bartkl
Copy link
Contributor

bartkl commented May 18, 2017

Ability to add custom options/flags to existing CLI commands

Hi,

I've written a small plugin that sets the genre of albums I import into beets to To Listen. This works fine, but I would like to add an --import-genre option to the import command so that my plugin will not apply the To Listen genre in case that flag is passed on the CLI.

I've browsed the source code and I think:

  1. Adding an option to a currently existing command is not possible using plugins
  2. Such a plugin won't be able to see the (extra) options passed to the import command

I can imagine (but have not verified) problem 2 can be circumvented by modifying the config object so that the plugin can access the setting that way, is that kind of right?

I would appreciate if someone could tell me whether I'm assessing my specific situation (more or less) the right way, and I think being able to extend the default commands is a feature request that adds power to beets.

Thanks!

@sampsyo
Copy link
Member

sampsyo commented May 18, 2017

Hi! The idea to add arbitrary command-line options to built-in beets commands has come up before, so it's worth considering—but it's deceptively complicated, and it (probably inevitably) ties us to a specific CLI parsing library.

For this particular case, though, have you seen #1881? The idea is to add a flag that lets you set any field to any value on import, including genre or even a special to_listen field that you invent.

@sampsyo sampsyo added the needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature." label May 18, 2017
@bartkl
Copy link
Contributor Author

bartkl commented May 18, 2017

#1881 sounds fine for my purpose indeed! I'll wait for that feature to get finished :).

As far as my feature request is concerned: I might look into it. I have been wanting to make my programming contribution debut for quite some time. If I do decide to pick it up I'll certainly discuss my ideas and plans here. Obviously I'll be reading the wiki first.

Thanks.

@sampsyo
Copy link
Member

sampsyo commented May 18, 2017

Great! Please do let us know if you need any help getting familiar with the codebase.

I'll close this now and redirect the discussion to #1881.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature."
Projects
None yet
Development

No branches or pull requests

2 participants