Title: First-character argument flag is undocumented and behaves strangely when colliding with default options · Issue #238 · google/python-fire · GitHub
Open Graph Title: First-character argument flag is undocumented and behaves strangely when colliding with default options · Issue #238 · google/python-fire
X Title: First-character argument flag is undocumented and behaves strangely when colliding with default options · Issue #238 · google/python-fire
Description: Consider the function signature: def main(headless=False): # Construct GUI if not headless: widget.show() app.exec() if __name__ == '__main__': fire.Fire(main) After reading through the user guide for fire, I would expect python myFile -...
Open Graph Description: Consider the function signature: def main(headless=False): # Construct GUI if not headless: widget.show() app.exec() if __name__ == '__main__': fire.Fire(main) After reading through the user guide ...
X Description: Consider the function signature: def main(headless=False): # Construct GUI if not headless: widget.show() app.exec() if __name__ == '__main__': fire.Fire(main) After reading through the use...
Opengraph URL: https://github.com/google/python-fire/issues/238
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"First-character argument flag is undocumented and behaves strangely when colliding with default options","articleBody":"Consider the function signature:\r\n\r\n```\r\ndef main(headless=False):\r\n # Construct GUI\r\n if not headless:\r\n widget.show()\r\n app.exec()\r\n\r\nif __name__ == '__main__': fire.Fire(main)\r\n```\r\n\r\nAfter reading through the user guide for fire, I would expect `python myFile -h` to produce the help signature for this file. However, it runs the script with `headless = True`.\r\n\r\nWhile in retrospect I suppose this makes sense, I would like some way of telling fire to disallow shortcut flags if they override user-expected options like --[i]nteractive, --[h]elp, etc. In those cases, the user can be forced to say `python myFile --headless` for the desired behavior.\r\n\r\nMoreover, if my script looked like this:\r\n```\r\ndef main(headless=False, hArg=True):\r\n # Construct GUI\r\n if not headless:\r\n widget.show()\r\n app.exec()\r\n\r\nif __name__ == '__main__': fire.Fire(main)\r\n```\r\nand I ran the same line of code, fire would appropriately err out. This is also acceptable in my opinion.\r\n\r\nMore importantly, the first-character flag behavior should at the very least be documented. I read through https://github.com/google/python-fire/blob/master/docs/guide.md and couldn't find it there.\r\n","author":{"url":"https://github.com/ntjess","@type":"Person","name":"ntjess"},"datePublished":"2020-04-01T00:34:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/238/python-fire/issues/238"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f431737c-f415-a76f-df88-5a580a92169c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8264:2CD26:62B361:916C02:6A4E102E |
| html-safe-nonce | ef81cf180911c289812c4c625590c98b9fd1a04150c594b7950ddbab5718f498 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjY0OjJDRDI2OjYyQjM2MTo5MTZDMDI6NkE0RTEwMkUiLCJ2aXNpdG9yX2lkIjoiODExOTUyOTk4ODYxMTI0ODE3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3e5aacb9c4538abfb6bb194f914fcffc6da5e763335c235a9fc37eb9d4c51c7d |
| hovercard-subject-tag | issue:591534285 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/google/python-fire/238/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ef30a8632971dff85395fad924e1ef0a9f9eb37d6106de97afb65523beb3d4c4/google/python-fire/issues/238 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ef30a8632971dff85395fad924e1ef0a9f9eb37d6106de97afb65523beb3d4c4/google/python-fire/issues/238 |
| og:image:alt | Consider the function signature: def main(headless=False): # Construct GUI if not headless: widget.show() app.exec() if __name__ == '__main__': fire.Fire(main) After reading through the user guide ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ntjess |
| hostname | github.com |
| expected-hostname | github.com |
| None | df0492960db29b4938cb72070351d6b1d0c6c0767b27ceb8394bbf4fcc0223c6 |
| turbo-cache-control | no-preview |
| go-import | github.com/google/python-fire git https://github.com/google/python-fire.git |
| octolytics-dimension-user_id | 1342004 |
| octolytics-dimension-user_login | |
| octolytics-dimension-repository_id | 82729529 |
| octolytics-dimension-repository_nwo | google/python-fire |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 82729529 |
| octolytics-dimension-repository_network_root_nwo | google/python-fire |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 51470c353b8a1f52a88d3e3cc2014b17ab8cc1ce |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width