You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 3, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: README.rst
+174-1Lines changed: 174 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,180 @@ Usage
42
42
print_table(['col1', 'col2'], rows)
43
43
44
44
45
-
.. _Click library: http://click.pocoo.org/3/
45
+
.. _Click library: http://click.pocoo.org/
46
+
47
+
Working Example
48
+
---------------
49
+
50
+
See this `example script`_ and the `shell script`_.
51
+
52
+
.. _example script: example.py
53
+
54
+
.. literalinclude:: example.py
55
+
:language: python3
56
+
:linenos:
57
+
58
+
59
+
.. _shell script: example.sh
60
+
61
+
.. literalinclude:: example.sh
62
+
:language: bash
63
+
:linenos:
64
+
65
+
::
66
+
67
+
$ ./example.py
68
+
Usage: example.py [OPTIONS] COMMAND [ARGS]...
69
+
70
+
Options:
71
+
-V, --version Print the current version number and exit.
72
+
-h, --help Show this message and exit.
73
+
74
+
Commands:
75
+
list Example for Listings
76
+
localtime Print the localtime
77
+
output Example for all possible Echo Formats You see...
78
+
work-in-progress Work untile working is done
79
+
work_done Work done in ?? %
80
+
81
+
::
82
+
83
+
$ ./example.py l
84
+
Usage: example.py [OPTIONS] COMMAND [ARGS]...
85
+
86
+
Error: Too many matches: list, localtime
87
+
88
+
::
89
+
90
+
$ ./example.py lo
91
+
Localtime: 2015-08-27 15:47:46.688547
92
+
93
+
::
94
+
95
+
$ ./example.py li
96
+
Identifier│Name │Status │Creation Date│Description │Without Title
97
+
0 Column #0 ERROR -4228033s ago this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.. column without title
98
+
1 Column #1 FINE -4228033s ago this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.. column without title
99
+
2 Column #2 WARNING -4228033s ago this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.. column without title
100
+
101
+
::
102
+
103
+
$ ./example.py li -o tsv
104
+
id name state creation_time desc without_title
105
+
0 Column #0 ERROR -4228033s ago this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description column without title
106
+
1 Column #1 FINE -4228033s ago this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description column without title
107
+
2 Column #2 WARNING -4228033s ago this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description column without title
108
+
109
+
::
110
+
111
+
$ ./example.py li -o json
112
+
[{"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"}]
113
+
114
+
::
115
+
116
+
$ ./example.py li -o yaml
117
+
creation_time: 1444911300
118
+
desc: this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description
119
+
id: 0
120
+
name: 'Column #0'
121
+
state: ERROR
122
+
without_title: column without title
123
+
---
124
+
creation_time: 1444911300
125
+
desc: this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description
126
+
id: 1
127
+
name: 'Column #1'
128
+
state: FINE
129
+
without_title: column without title
130
+
---
131
+
creation_time: 1444911300
132
+
desc: this is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long description
133
+
id: 2
134
+
name: 'Column #2'
135
+
state: WARNING
136
+
without_title: column without title
137
+
138
+
139
+
::
140
+
141
+
$ ./example.py work-
142
+
do anything.. OK
143
+
create an excption.. EXCEPTION OCCURRED: No active exception to reraise
144
+
Start with working.. . . . . OK
145
+
Calc 1 + 1.. 2
146
+
Oh, I make an error.. work not complete done
147
+
Oh, I make a warning.. work is complicated
148
+
Start an exception.. EXCEPTION OCCURRED: name 'function_not_found' is not defined
0 commit comments