Giter Site home page Giter Site logo

support -h ? about click HOT 8 CLOSED

pallets avatar pallets commented on August 25, 2024
support -h ?

from click.

Comments (8)

lra avatar lra commented on August 25, 2024

Also too much info might be counterproductive, but mentioning the default help option might help here?

from click.

douglarek avatar douglarek commented on August 25, 2024

@lra maybe since -h does not follow the UNIX command line conventions.

read this: http://click.pocoo.org/why/

from click.

mitsuhiko avatar mitsuhiko commented on August 25, 2024

-h is commonly used as different argument. --help is the standard way to invoke the help page of a script.

from click.

untitaker avatar untitaker commented on August 25, 2024

Maybe make it configurable? Most commands have -h show the help.

from click.

douglarek avatar douglarek commented on August 25, 2024

@untitaker If you really want to have -h, you can do it as below:

import click

def print_help(ctx, value):
    if not value:
        return
    print ctx.format_help()
    ctx.exit()

@click.command()
@click.option('-h', is_flag=True, callback=print_help, expose_value=False,
        is_eager=True, help='Show this message and exit.')
def hello():
    pass


if __name__ == '__main__':
    hello()

from click.

untitaker avatar untitaker commented on August 25, 2024

OTOH that seems like fighting or working around the framework.

from click.

douglarek avatar douglarek commented on August 25, 2024

@untitaker Not so serious, it is Click's very cool feature: http://click.pocoo.org/options/#callbacks-and-eager-options.

from click.

lra avatar lra commented on August 25, 2024

Is there any place we can read about this unix command line convention? I'm curious and would also like to apply it to my programs.

from click.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.