Comments (8)
You can change the default parameters from @extra_command
with the params=
argument. This is referenced in the documentation at: https://kdeldycke.github.io/click-extra/commands.html#change-default-options
So this should work for you:
from click_extra import extra_command
@extra_command(params=[])
def cli():
pass
Now considering your question, maybe I should add an explicit explanation in the docs for that particular case of stripping all default options.
from click-extra.
I finally addressed that need in ac275b5.
It was way more complicated that I anticipated, but it simplifies a lot this use-case.
Now to disable all default parameters from extra commands while keeping the coloring, you can do:
from click_extra import extra_command
@extra_command(params=None)
def cli():
pass
I'll document this soon and it will be available in the upcoming release of Click Extra v4.6.0.
from click-extra.
Thank you very much. I read all the docs but there was not a clear explanation. I had found a way but your solution is more clear and easy.
from click-extra.
I just tried your solution but it does not colorize
the help output. :(
I created my_click_extra.py
file with following content and If I use following group
decorator by importing, then it works.
import cloup as _cloup
import click_extra as _ce
def _extra_params():
return [
_ce.colorize.HelpOption(),
]
group = _ce.decorators.decorator_factory(
dec=_cloup.group,
cls=_ce.commands.ExtraGroup,
params=_extra_params,
)
from click-extra.
Thanks @isezen for the code example.
So yes you are right, the solution I proposed earlier could not work. I just realized that most of the color-related behavior are implemented in Click Extra's --help
and --no-color
custom options.
I need to think about how to make your use-case easy. Something like creating another set of decorators, like @colored_command()
and @colored_group()
, which would be like @extra_command
and @extra_group
, but with the minimal options to make the output coloured.
I'll put that in the backburner as I have other things to stabilize in Click Extra before I can cut a release. But if you feel like creating a PR for that, I'll be happy to merge it upstream! :)
from click-extra.
Thank you for encouraging me to be included in the project :) You are very kind. I created a PR for your approval. I'm studying click_extra
, cloup
and click
code, I hope I can contribute more in the future. Thank you very much for your work.
from click-extra.
For the record, new colour-preserving decorators were proposed at: #543
from click-extra.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from click-extra.
Related Issues (20)
- Broken links HOT 1
- Broken links HOT 1
- Broken links HOT 1
- Broken links HOT 1
- Broken links HOT 1
- Broken links HOT 1
- Remove runtime dependencies on sphinx and so on HOT 2
- Broken links HOT 1
- Broken links HOT 1
- Broken links HOT 1
- Broken links HOT 1
- Broken links HOT 1
- Broken links HOT 1
- Broken links HOT 1
- Broken links HOT 1
- Yaml config not working HOT 2
- double @config_option on help HOT 3
- Broken links
- Broken links
- Broken links
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from click-extra.