GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Documentation: mention required=True for options · Issue #514 · pallets/click

Documentation: mention required=True for options #514

New issue
Copy link
New issue
Copy link
Closed
Closed
Documentation: mention required=True for options#514
Copy link
Labels
docsUpdates to documentation, readme, docstrings, typos
Milestone
7.0

Description

@gibiansky
gibiansky
opened on Feb 4, 2016
Issue body actions

This is never mentioned as a possibility for click.option anywhere in the docs as far as I can tell (or at least it should be more prominent, maybe a section). (it talks about it in click.argument, but its unclear that it exists for both)

Someone just came to me saying, "we have to stop using click, i checked everywhere in their documentation, they don't support required options, which is important!"

Thanks :)

Reacted by Stephen Rosen, Eyal Levin, Mike Nerone, Christian Hotz-Behofsits, keisar, marthjod, Hugh Saunders, Morris Alper, Sam Mingo, NAKATA Keisuke and 29 more

Activity

Next
  1. gibiansky
    changed the title [-]Documentation: mention required=True[/-] [+]Documentation: mention required=True for options[/+] on Feb 4, 2016
  2. rsiemens commented on Feb 5, 2016

    @rsiemens
    rsiemens
    on Feb 5, 2016
    Contributor
    More actions

    I think its intentional that it is not mentioned. Per the doc here

    As its name indicates, an option is optional. While arguments can be optional within reason, they are much more restricted in how optional they can be.
    

    While you can have required options, the nature of an option is that it is not required. Perhaps using the default=value would be better.

  3. pmdarrow commented on Feb 5, 2016

    @pmdarrow
    pmdarrow
    on Feb 5, 2016
    More actions

    @nudies by why provide the option if it's not intended to be used? IMO it should be removed from the public API or documented.

    Reacted by Ales Zoulek and Gui Talarico
  4. gibiansky commented on Feb 8, 2016

    @gibiansky
    gibiansky
    on Feb 8, 2016
    Author
    More actions

    I don't know if this is an intended usecase, or maybe we are misusing click, but for us, all our command line parameters are options. Arguments do not provide the --name syntax, and for our CLIs we want every single thing to be prefixed with --what-it-is, in the style of keyword arguments in Python. As a result we use click.option almost exclusively, except for when we need nargs=-1; but that means that we need required=True sometimes for click.option.

    Please don't remove remove this functionality; we would be very sad if our use case were deprecated for purely aesthetic reasons

    Reacted by Eyal Levin, Mike Nerone, dseisun-stripe, Sam Mingo, M, Ales Zoulek, Jason Nader, Dmitry Kartsev, Nimish Telang, Laurent Direr and 23 more
  5. pmdarrow commented on Feb 8, 2016

    @pmdarrow
    pmdarrow
    on Feb 8, 2016
    More actions

    I should have mentioned I'm in favour of documenting & supporting it as well, not removing it (I realize it didn't sound like that from my comment).

    Reacted by Sam Mingo and Tamás Szelei
  6. ariscn commented on Mar 22, 2016

    @ariscn
    ariscn
    on Mar 22, 2016
    More actions

    Big +1 for all the reasons stated. Options are self-documenting (--my-whatever foo), and are sometimes (often!) required.

    Reacted by Sam Mingo, Ales Zoulek, Benjamin and Justin Poehnelt
  7. fleipold commented on Sep 13, 2016

    @fleipold
    fleipold
    on Sep 13, 2016
    More actions

    I have also switched to using named options as named arguments. This seems to be a widely used practice.

    Reacted by Peter Darrow, Stephen Rosen, Eyal Levin, Mike Nerone and Sam Mingo
  8. rr326 commented on Jan 10, 2017

    @rr326
    rr326
    on Jan 10, 2017
    More actions

    +1 as well. I KNEW there must be a "required" field - and this issue is where I found the documentation!

    Reacted by Mikko Ohtamaa, Sam Mingo, Craig Patten, Seth Porter, Sam Partington and Zander
  9. marcinpraczko commented on Apr 7, 2017

    @marcinpraczko
    marcinpraczko
    on Apr 7, 2017
    More actions

    +1 to document this - still seems be not documented.
    And in multiple arguments having required option is happening more quite often. For example writing something for search (as I am doing now).
    So need following syntax:

    app command --search 'string'
    # --search is required at this moment

    So I would ask for updating documentation as well.

    Reacted by Sam Mingo, outime, howdydoody123, Dmitry Kartsev and kevgliss
  10. davidvhill commented on Jul 20, 2017

    @davidvhill
    davidvhill
    on Jul 20, 2017
    More actions

    +1 Named in lieu of positional parameters are pretty important for us to help prevent coding errors. In our case the named parameters are not optional.

  11. burakalver commented on Apr 8, 2018

    @burakalver
    burakalver
    on Apr 8, 2018
    More actions

    also useful for "if option a is provided than option b is required"; otherwise b is optional.

  12. fdavis
    added
    docsUpdates to documentation, readme, docstrings, typos
    good first issue
    on May 15, 2018
  13. jcrotts
    added
    wontfix
    on May 15, 2018
  14. 4 remaining items

  15. fdavis
    added
    good first issue
    on May 15, 2018
  16. davidism
    added a commit that references this issue on May 18, 2018

    Fixes issue #514

    1a0975b
  17. davidism
    closed this as completedon May 18, 2018
  18. gibiansky commented on May 18, 2018

    @gibiansky
    gibiansky
    on May 18, 2018
    Author
    More actions

    Two years later I am delighted :) Thank you! (For fixing the issue and for an awesome library I've been using for years now!)

    Reacted by Tamás Szelei, Oskar Weser, scgbckbone, Brian Donaldson, Alexander Elvers and Krassimir Valev
  19. pallets
    deleted a comment from GrimzEcho on Jul 17, 2018
  20. pallets
    deleted a comment from Trepix on Jul 17, 2018
  21. pallets
    deleted a comment from acompanys on Jul 17, 2018
  22. pallets
    deleted a comment from starplanet on Jul 17, 2018
  23. pallets
    deleted a comment from khunafin on Jul 17, 2018
  24. pallets
    deleted a comment from jmichalek132 on Jul 17, 2018
  25. pallets
    deleted a comment from niothiel on Jul 17, 2018
  26. pallets
    deleted a comment from demarlik01 on Jul 17, 2018
  27. pallets
    deleted a comment from quasiben on Jul 17, 2018
  28. pallets
    locked as resolved and limited conversation to collaborators on Jul 17, 2018
  29. davidism
    added this to the 7.0 milestone on Sep 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsUpdates to documentation, readme, docstrings, typos

    Type

    No type

    Projects

    No projects

      Milestone

      • 7.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.