django-click icon indicating copy to clipboard operation
django-click copied to clipboard

django-click commands do not accept `base_stealth_options`

Open DMR-coding opened this issue 6 years ago • 4 comments

Django commands by default support the options skip_checks, stderr, and stdout. However, django-click commands do not. This incompatibility with the basic command contract causes problems particularly in testing.

DMR-coding avatar Aug 01 '19 23:08 DMR-coding

Howdy @DMR-coding - is there anywhere in the documentation where I can see more information on this? I don't see any details here:

https://docs.djangoproject.com/en/3.0/howto/custom-management-commands/

Or is this part of the API that isn't documented?

I see --skip-checks supported since Django 3.0 on certain commands, but not on custom commands. Thanks for the heads up!

FlipperPA avatar Jun 20 '20 23:06 FlipperPA

I'm afraid it's been a long enough time since the initial writing that I don't remember where to find any documentation on the matter, if any, and some quick research didn't turn it up.

These are called "stealth options" in the code; they're defined here: https://github.com/django/django/blob/c60524c658f197f645b638f9bcc553103bfe2630/django/core/management/base.py#L235

(skip_checks is no longer one of the base_stealth_options as of 3.0)

DMR-coding avatar Jun 25 '20 00:06 DMR-coding

It seems the lack of stealth options "stdout" and "stderr" makes django-click incompatible with non-CLI runners which use these to capture the output from the command. e.g. django-executor, django-admintool-command , and probably django-chroniker but I havent tried that yet

jayvdb avatar Aug 07 '20 08:08 jayvdb

It looks like current versions of Django only support stdout and stderr as stealth options. Just noting here: https://github.com/django/django/blob/master/django/core/management/base.py#L235

Do we just need to add them here? https://github.com/GaretJax/django-click/blob/master/djclick/adapter.py#L40

FlipperPA avatar Aug 09 '20 19:08 FlipperPA