-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Call pre,post_command with more arguments (args, CLI invocation) #13924
Comments
Is there a reason we can't just use? from conda.base.context import context
context.raw_data["cmd_line"] I know it's not the prettiest data to work with 😅. Here's what it looks like for {
'base': {
'source': 'cmd_line', 'key': 'base', '_raw_value': True
},
'cmd': {
'source': 'cmd_line', 'key': 'cmd', '_raw_value': 'info'
},
'envs': {
'source': 'cmd_line', 'key': 'envs', '_raw_value': False
},
'func': {
'source': 'cmd_line', 'key': 'func', '_raw_value': 'conda.cli.main_info.execute'
},
'license': {
'source': 'cmd_line', 'key': 'license', '_raw_value': False
},
'system': {
'source': 'cmd_line', 'key': 'system', '_raw_value': False
},
'unsafe_channels': {
'source': 'cmd_line', 'key': 'unsafe_channels', '_raw_value': False
}
} That should give you everything you need though, right?
Maybe instead, we should make something like "cli_args" available on the context object? Going forward this would appear the same regardless of the underlying configuration system implementation. Just some food for though 🍎. |
Huh, I wasn't aware of that attribute. That could work. Although I do agree is probably a bad idea :P |
Apparently we have it at |
For those reading, I'm using
|
Checklist
What is the idea?
Plugins implementing the pre,post_command hooks should have access to the full invocation, not just the subcommand name. This allows for more flexible introspection of what to do under certain conditions.
Why is this needed?
Current implementation only passes the command name.
What should happen?
Should become
I guess we'll have to add a new plugin hook type
PostCommandWithArgs
or something similar to not break any API.Additional Context
Finding this limitation in the development of
conda-checkpoints
, where I can't find the original command to annotate the checkpoint with. We can usesys.argv
but that might be blank if called from theconda_cli()
wrapper or other Python invocations.The text was updated successfully, but these errors were encountered: