Title: Defaults for kwonly arguments don't show in help · Issue #410 · google/python-fire · GitHub
Open Graph Title: Defaults for kwonly arguments don't show in help · Issue #410 · google/python-fire
X Title: Defaults for kwonly arguments don't show in help · Issue #410 · google/python-fire
Description: Fire (v0.4.0, master) does not seem to show default values for keyword-only arguments. Consider the following example: #!/usr/bin/env python3 import fire def foo(*, bar=True): print(bar) if __name__ == '__main__': fire.Fire(foo) Save it ...
Open Graph Description: Fire (v0.4.0, master) does not seem to show default values for keyword-only arguments. Consider the following example: #!/usr/bin/env python3 import fire def foo(*, bar=True): print(bar) if __name_...
X Description: Fire (v0.4.0, master) does not seem to show default values for keyword-only arguments. Consider the following example: #!/usr/bin/env python3 import fire def foo(*, bar=True): print(bar) if __name_...
Opengraph URL: https://github.com/google/python-fire/issues/410
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Defaults for kwonly arguments don't show in help","articleBody":"Fire (v0.4.0, master) does not seem to show default values for keyword-only arguments. Consider the following example:\r\n\r\n```python\r\n#!/usr/bin/env python3\r\n\r\nimport fire\r\n\r\n\r\ndef foo(*, bar=True):\r\n print(bar)\r\n\r\n\r\nif __name__ == '__main__':\r\n fire.Fire(foo)\r\n```\r\n\r\nSave it as `foo.py` and run `python3 foo.py --help`.\r\n\r\n### Expected Output:\r\n\r\n```shell\r\nINFO: Showing help with the command 'foo.py -- --help'.\r\n\r\nNAME\r\n foo.py\r\n\r\nSYNOPSIS\r\n foo.py \u003cflags>\r\n\r\nFLAGS\r\n --bar=BAR\r\n Default: True\r\n```\r\n\r\n### Actual Output:\r\n\r\n```shell\r\nINFO: Showing help with the command 'foo.py -- --help'.\r\n\r\nNAME\r\n foo.py\r\n\r\nSYNOPSIS\r\n foo.py \u003cflags>\r\n\r\nFLAGS\r\n --bar=BAR\r\n```\r\n\r\nLooks like a one line change could fix this: change the `return` statement here https://github.com/google/python-fire/blob/37c4305194ff3d0a63f435f08a40e14b1978bd4e/fire/helptext.py#L527 to:\r\n\r\n```python\r\n return repr(spec.kwonlydefaults.get(flag, ''))\r\n```","author":{"url":"https://github.com/melsabagh","@type":"Person","name":"melsabagh"},"datePublished":"2022-10-20T22:33:12Z","url":"https://github.com/google/python-fire/issues/410"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:65b0bab5-7dcc-b5bb-303b-7204611ce55d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A5C4:1A7566:95232:C91EC:6B001BC9 |
| html-safe-nonce | ffa68cf0a07a038ec4a4c05501653c78400c354e7ab1f86011420e2b29e36910 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNUM0OjFBNzU2Njo5NTIzMjpDOTFFQzo2QjAwMUJDOSIsInZpc2l0b3JfaWQiOiI4MzcwMTgzMjIzNDU1NTIxNzM3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a2db890de468ee3aa22e32722f56cb5afc4599c43bdecb8201251967160859f2 |
| hovercard-subject-tag | issue:1417402459 |
| 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/410/issue_layout |
| twitter:image | https://opengraph.githubassets.com/68dd50c3d5470c090bee810136991b362a3b9fc25a64442e54e76f56f9a1b229/google/python-fire/issues/410 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/68dd50c3d5470c090bee810136991b362a3b9fc25a64442e54e76f56f9a1b229/google/python-fire/issues/410 |
| og:image:alt | Fire (v0.4.0, master) does not seem to show default values for keyword-only arguments. Consider the following example: #!/usr/bin/env python3 import fire def foo(*, bar=True): print(bar) if __name_... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | melsabagh |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width