METADATA 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. Metadata-Version: 2.1
  2. Name: clickclick
  3. Version: 20.10.2
  4. Summary: Click utility functions
  5. Home-page: https://codeberg.org/hjacobs/python-clickclick
  6. Author: Henning Jacobs
  7. Author-email: henning.jacobs@jacobs1.de
  8. License: Apache License 2.0
  9. Keywords: click console terminal cli
  10. Platform: UNKNOWN
  11. Classifier: Development Status :: 5 - Production/Stable
  12. Classifier: Environment :: Console
  13. Classifier: Intended Audience :: Developers
  14. Classifier: Intended Audience :: System Administrators
  15. Classifier: License :: OSI Approved :: Apache Software License
  16. Classifier: Operating System :: POSIX :: Linux
  17. Classifier: Programming Language :: Python
  18. Classifier: Programming Language :: Python :: 3.6
  19. Classifier: Programming Language :: Python :: 3.7
  20. Classifier: Programming Language :: Python :: 3.8
  21. Classifier: Programming Language :: Python :: Implementation :: CPython
  22. Requires-Dist: PyYAML (>=3.11)
  23. Requires-Dist: click (>=4.0)
  24. ===========
  25. Click Click
  26. ===========
  27. .. image:: https://travis-ci.org/hjacobs/python-clickclick.svg?branch=master
  28. :target: https://travis-ci.org/hjacobs/python-clickclick
  29. :alt: Travis CI build status
  30. .. image:: https://coveralls.io/repos/hjacobs/python-clickclick/badge.svg
  31. :target: https://coveralls.io/r/hjacobs/python-clickclick
  32. .. image:: https://img.shields.io/pypi/dw/clickclick.svg
  33. :target: https://pypi.python.org/pypi/clickclick/
  34. :alt: PyPI Downloads
  35. .. image:: https://img.shields.io/pypi/v/clickclick.svg
  36. :target: https://pypi.python.org/pypi/clickclick/
  37. :alt: Latest PyPI version
  38. .. image:: https://img.shields.io/pypi/l/clickclick.svg
  39. :target: https://pypi.python.org/pypi/clickclick/
  40. :alt: License
  41. Utility functions (Python 3 only) for the wonderful `Click library`_.
  42. Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary.
  43. Usage
  44. =====
  45. .. code-block:: python
  46. from clickclick import Action, OutputFormat
  47. with Action('Performing remote call..') as act:
  48. do_something()
  49. act.progress()
  50. do_something_else()
  51. output_format = 'json' # default: "text"
  52. with OutputFormat(output_format):
  53. print_table(['col1', 'col2'], rows)
  54. .. _Click library: http://click.pocoo.org/
  55. Working Example
  56. ---------------
  57. See this `example script`_ and the `shell script`_.
  58. .. _example script: example.py
  59. .. _shell script: example.sh
  60. .. code-block:: python3
  61. $ ./example.py
  62. Usage: example.py [OPTIONS] COMMAND [ARGS]...
  63. Options:
  64. -V, --version Print the current version number and exit.
  65. -h, --help Show this message and exit.
  66. Commands:
  67. list Example for Listings
  68. localtime Print the localtime
  69. output Example for all possible Echo Formats You see...
  70. work-in-progress Work untile working is done
  71. work_done Work done in ?? %
  72. ::
  73. $ ./example.py l
  74. Usage: example.py [OPTIONS] COMMAND [ARGS]...
  75. Error: Too many matches: list, localtime
  76. ::
  77. $ ./example.py lo
  78. Localtime: 2015-08-27 15:47:46.688547
  79. ::
  80. $ ./example.py li
  81. Identifier|Name |Status |Creation Date|Description |Without Title
  82. 0 Column #0 ERROR -4228033s ago this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.. column without title
  83. 1 Column #1 FINE -4228033s ago this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.. column without title
  84. 2 Column #2 WARNING -4228033s ago this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.. column without title
  85. ::
  86. $ ./example.py li -o tsv
  87. id name state creation_time desc without_title
  88. 0 Column #0 ERROR -4228033s ago this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description column without title
  89. 1 Column #1 FINE -4228033s ago this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description column without title
  90. 2 Column #2 WARNING -4228033s ago this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description column without title
  91. ::
  92. $ ./example.py li -o json
  93. [{"creation_time": 1444911300, "desc": "this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description", "id": 0, "name": "Column #0", "state": "ERROR", "without_title": "column without title"}, {"creation_time": 1444911300, "desc": "this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description", "id": 1, "name": "Column #1", "state": "FINE", "without_title": "column without title"}, {"creation_time": 1444911300, "desc": "this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description", "id": 2, "name": "Column #2", "state": "WARNING", "without_title": "column without title"}]
  94. ::
  95. $ ./example.py li -o yaml
  96. creation_time: 1444911300
  97. desc: this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description
  98. id: 0
  99. name: 'Column #0'
  100. state: ERROR
  101. without_title: column without title
  102. ---
  103. creation_time: 1444911300
  104. desc: this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description
  105. id: 1
  106. name: 'Column #1'
  107. state: FINE
  108. without_title: column without title
  109. ---
  110. creation_time: 1444911300
  111. desc: this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description
  112. id: 2
  113. name: 'Column #2'
  114. state: WARNING
  115. without_title: column without title
  116. ::
  117. $ ./example.py work-
  118. do anything.. OK
  119. create an excption.. EXCEPTION OCCURRED: No active exception to reraise
  120. Start with working.. . . . . OK
  121. Calc 1 + 1.. 2
  122. Oh, I make an error.. work not complete done
  123. Oh, I make a warning.. work is complicated
  124. Start an exception.. EXCEPTION OCCURRED: name 'function_not_found' is not defined
  125. Make a final error.. this is the end..
  126. ::
  127. $ ./example.py work_ 15.4
  128. Please select the state of your work
  129. 1) Done
  130. 2) In Progress
  131. 3) unknown
  132. 4) lost
  133. Please select (1-4) [4]: 2
  134. Your work is 15.4% In Progress
  135. ::
  136. $ ./example.py work_ 15.4
  137. Please select the state of your work
  138. 1) Done
  139. 2) In Progress
  140. 3) unknown
  141. 4) lost
  142. Please select (1-4) [4]: 3
  143. Your work is 15.4% unknown
  144. ::
  145. $ ./example.py work_ 15.4
  146. Please select the state of your work
  147. 1) Done
  148. 2) In Progress
  149. 3) unknown
  150. 4) lost
  151. Please select (1-4) [4]:
  152. Your work is 15.4% lost
  153. ::
  154. $ ./example.py output
  155. This is a ok: OK
  156. This is a ok with message:all is fine
  157. This is a warning: please check this
  158. Start with working.. . . . . OK
  159. Id|Name
  160. 1 Test #1
  161. 2 Test #2
  162. Only FYI
  163. This is a error: this is wrong, please fix
  164. This is a fatal error: this is a fuckup
  165. ::
  166. $ ./example.py output -o tsv
  167. id name
  168. 1 Test #1
  169. 2 Test #2
  170. ::
  171. $ ./example.py output -o json
  172. [{"id": 1, "name": "Test #1"}, {"id": 2, "name": "Test #2"}]
  173. ::
  174. $ ./example.py output -o yaml
  175. id: 1
  176. name: 'Test #1'
  177. ---
  178. id: 2
  179. name: 'Test #2'
  180. License
  181. =======
  182. Copyright (c) 2015-2019 Zalando SE
  183. Licensed under the Apache License, Version 2.0 (the "License");
  184. you may not use this file except in compliance with the License.
  185. You may obtain a copy of the License at
  186. http://www.apache.org/licenses/LICENSE-2.0
  187. Unless required by applicable law or agreed to in writing, software
  188. distributed under the License is distributed on an "AS IS" BASIS,
  189. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  190. See the License for the specific language governing permissions and
  191. limitations under the License.