Skip to content

Commit d980818

Browse files
committed
docs: autoupdate
1 parent a812c8e commit d980818

1 file changed

Lines changed: 82 additions & 48 deletions

File tree

README.md

Lines changed: 82 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -77,32 +77,34 @@ Special thanks to github.com/k0kubun/go\-ansi which this project is based on.
7777

7878
## Index
7979

80-
- [func Bottom()](<#func-bottom>)
81-
- [func ClearLine()](<#func-clearline>)
82-
- [func ClearLinesDown(n int)](<#func-clearlinesdown>)
83-
- [func ClearLinesUp(n int)](<#func-clearlinesup>)
84-
- [func Down(n int)](<#func-down>)
85-
- [func DownAndClear(n int)](<#func-downandclear>)
86-
- [func Hide()](<#func-hide>)
87-
- [func HorizontalAbsolute(n int)](<#func-horizontalabsolute>)
88-
- [func Left(n int)](<#func-left>)
89-
- [func Move(x, y int)](<#func-move>)
90-
- [func Right(n int)](<#func-right>)
91-
- [func SetTarget(w Writer)](<#func-settarget>)
92-
- [func Show()](<#func-show>)
93-
- [func StartOfLine()](<#func-startofline>)
94-
- [func StartOfLineDown(n int)](<#func-startoflinedown>)
95-
- [func StartOfLineUp(n int)](<#func-startoflineup>)
96-
- [func TestCustomIOWriter(t *testing.T)](<#func-testcustomiowriter>)
97-
- [func Up(n int)](<#func-up>)
98-
- [func UpAndClear(n int)](<#func-upandclear>)
99-
- [type Area](<#type-area>)
100-
- [func NewArea() Area](<#func-newarea>)
101-
- [func (area *Area) Clear()](<#func-area-clear>)
102-
- [func (area *Area) Update(content string)](<#func-area-update>)
103-
- [type Writer](<#type-writer>)
104-
105-
80+
- [func Bottom\(\)](<#Bottom>)
81+
- [func ClearLine\(\)](<#ClearLine>)
82+
- [func ClearLinesDown\(n int\)](<#ClearLinesDown>)
83+
- [func ClearLinesUp\(n int\)](<#ClearLinesUp>)
84+
- [func Down\(n int\)](<#Down>)
85+
- [func DownAndClear\(n int\)](<#DownAndClear>)
86+
- [func Hide\(\)](<#Hide>)
87+
- [func HorizontalAbsolute\(n int\)](<#HorizontalAbsolute>)
88+
- [func Left\(n int\)](<#Left>)
89+
- [func Move\(x, y int\)](<#Move>)
90+
- [func Right\(n int\)](<#Right>)
91+
- [func SetTarget\(w Writer\)](<#SetTarget>)
92+
- [func Show\(\)](<#Show>)
93+
- [func StartOfLine\(\)](<#StartOfLine>)
94+
- [func StartOfLineDown\(n int\)](<#StartOfLineDown>)
95+
- [func StartOfLineUp\(n int\)](<#StartOfLineUp>)
96+
- [func TestCustomIOWriter\(t \*testing.T\)](<#TestCustomIOWriter>)
97+
- [func Up\(n int\)](<#Up>)
98+
- [func UpAndClear\(n int\)](<#UpAndClear>)
99+
- [type Area](<#Area>)
100+
- [func NewArea\(\) Area](<#NewArea>)
101+
- [func \(area \*Area\) Clear\(\)](<#Area.Clear>)
102+
- [func \(area \*Area\) Update\(content string\)](<#Area.Update>)
103+
- [func \(area Area\) WithWriter\(writer Writer\) Area](<#Area.WithWriter>)
104+
- [type Writer](<#Writer>)
105+
106+
107+
<a name="Bottom"></a>
106108
## func [Bottom](<https://github.com/atomicgo/cursor/blob/main/utils.go#L9>)
107109

108110
```go
@@ -111,30 +113,34 @@ func Bottom()
111113

112114
Bottom moves the cursor to the bottom of the terminal. This is done by calculating how many lines were moved by Up and Down.
113115

114-
## func [ClearLine](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L67>)
116+
<a name="ClearLine"></a>
117+
## func [ClearLine](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L68>)
115118

116119
```go
117120
func ClearLine()
118121
```
119122

120123
ClearLine clears the current line and moves the cursor to it's start position.
121124

122-
## func [ClearLinesDown](<https://github.com/atomicgo/cursor/blob/main/utils.go#L71>)
125+
<a name="ClearLinesDown"></a>
126+
## func [ClearLinesDown](<https://github.com/atomicgo/cursor/blob/main/utils.go#L72>)
123127

124128
```go
125129
func ClearLinesDown(n int)
126130
```
127131

128132
ClearLinesDown clears n lines downwards from the current position and moves the cursor.
129133

130-
## func [ClearLinesUp](<https://github.com/atomicgo/cursor/blob/main/utils.go#L64>)
134+
<a name="ClearLinesUp"></a>
135+
## func [ClearLinesUp](<https://github.com/atomicgo/cursor/blob/main/utils.go#L65>)
131136

132137
```go
133138
func ClearLinesUp(n int)
134139
```
135140

136141
ClearLinesUp clears n lines upwards from the current position and moves the cursor.
137142

143+
<a name="Down"></a>
138144
## func [Down](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L26>)
139145

140146
```go
@@ -143,54 +149,61 @@ func Down(n int)
143149

144150
Down moves the cursor n lines down relative to the current position.
145151

146-
## func [DownAndClear](<https://github.com/atomicgo/cursor/blob/main/utils.go#L41>)
152+
<a name="DownAndClear"></a>
153+
## func [DownAndClear](<https://github.com/atomicgo/cursor/blob/main/utils.go#L42>)
147154

148155
```go
149156
func DownAndClear(n int)
150157
```
151158

152159
DownAndClear moves the cursor down by n lines, then clears the line.
153160

154-
## func [Hide](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L62>)
161+
<a name="Hide"></a>
162+
## func [Hide](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L63>)
155163

156164
```go
157165
func Hide()
158166
```
159167

160168
Hide the cursor. Don't forget to show the cursor at least at the end of your application with Show. Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal.
161169

162-
## func [HorizontalAbsolute](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L47>)
170+
<a name="HorizontalAbsolute"></a>
171+
## func [HorizontalAbsolute](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L48>)
163172

164173
```go
165174
func HorizontalAbsolute(n int)
166175
```
167176

168177
HorizontalAbsolute moves the cursor to n horizontally. The position n is absolute to the start of the line.
169178

170-
## func [Left](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L41>)
179+
<a name="Left"></a>
180+
## func [Left](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L42>)
171181

172182
```go
173183
func Left(n int)
174184
```
175185

176186
Left moves the cursor n characters to the left relative to the current position.
177187

178-
## func [Move](<https://github.com/atomicgo/cursor/blob/main/utils.go#L47>)
188+
<a name="Move"></a>
189+
## func [Move](<https://github.com/atomicgo/cursor/blob/main/utils.go#L48>)
179190

180191
```go
181192
func Move(x, y int)
182193
```
183194

184195
Move moves the cursor relative by x and y.
185196

186-
## func [Right](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L36>)
197+
<a name="Right"></a>
198+
## func [Right](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L37>)
187199

188200
```go
189201
func Right(n int)
190202
```
191203

192204
Right moves the cursor n characters to the right relative to the current position.
193205

206+
<a name="SetTarget"></a>
194207
## func [SetTarget](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L15>)
195208

196209
```go
@@ -199,44 +212,52 @@ func SetTarget(w Writer)
199212

200213
SetTarget allows for any arbitrary io.Writer to be used for cursor movement \(will not work on Windows\).
201214

202-
## func [Show](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L55>)
215+
<a name="Show"></a>
216+
## func [Show](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L56>)
203217

204218
```go
205219
func Show()
206220
```
207221

208222
Show the cursor if it was hidden previously. Don't forget to show the cursor at least at the end of your application. Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal.
209223

210-
## func [StartOfLine](<https://github.com/atomicgo/cursor/blob/main/utils.go#L18>)
224+
<a name="StartOfLine"></a>
225+
## func [StartOfLine](<https://github.com/atomicgo/cursor/blob/main/utils.go#L19>)
211226

212227
```go
213228
func StartOfLine()
214229
```
215230

216231
StartOfLine moves the cursor to the start of the current line.
217232

218-
## func [StartOfLineDown](<https://github.com/atomicgo/cursor/blob/main/utils.go#L23>)
233+
<a name="StartOfLineDown"></a>
234+
## func [StartOfLineDown](<https://github.com/atomicgo/cursor/blob/main/utils.go#L24>)
219235

220236
```go
221237
func StartOfLineDown(n int)
222238
```
223239

224240
StartOfLineDown moves the cursor down by n lines, then moves to cursor to the start of the line.
225241

226-
## func [StartOfLineUp](<https://github.com/atomicgo/cursor/blob/main/utils.go#L29>)
242+
<a name="StartOfLineUp"></a>
243+
## func [StartOfLineUp](<https://github.com/atomicgo/cursor/blob/main/utils.go#L30>)
227244

228245
```go
229246
func StartOfLineUp(n int)
230247
```
231248

232249
StartOfLineUp moves the cursor up by n lines, then moves to cursor to the start of the line.
233250

234-
## func [TestCustomIOWriter](<https://github.com/atomicgo/cursor/blob/main/cursor_test_linux.go#L9>)
251+
<a name="TestCustomIOWriter"></a>
252+
## func [TestCustomIOWriter](<https://github.com/atomicgo/cursor/blob/main/cursor_test_linux.go#L10>)
235253

236254
```go
237255
func TestCustomIOWriter(t *testing.T)
238256
```
239257

258+
TestCustomIOWriter tests the cursor functions with a custom Writer.
259+
260+
<a name="Up"></a>
240261
## func [Up](<https://github.com/atomicgo/cursor/blob/main/cursor.go#L20>)
241262

242263
```go
@@ -245,15 +266,17 @@ func Up(n int)
245266

246267
Up moves the cursor n lines up relative to the current position.
247268

248-
## func [UpAndClear](<https://github.com/atomicgo/cursor/blob/main/utils.go#L35>)
269+
<a name="UpAndClear"></a>
270+
## func [UpAndClear](<https://github.com/atomicgo/cursor/blob/main/utils.go#L36>)
249271

250272
```go
251273
func UpAndClear(n int)
252274
```
253275

254276
UpAndClear moves the cursor up by n lines, then clears the line.
255277

256-
## type [Area](<https://github.com/atomicgo/cursor/blob/main/area.go#L10-L12>)
278+
<a name="Area"></a>
279+
## type [Area](<https://github.com/atomicgo/cursor/blob/main/area.go#L11-L14>)
257280

258281
Area displays content which can be updated on the fly. You can use this to create live output, charts, dropdowns, etc.
259282

@@ -263,31 +286,44 @@ type Area struct {
263286
}
264287
```
265288

266-
### func [NewArea](<https://github.com/atomicgo/cursor/blob/main/area.go#L15>)
289+
<a name="NewArea"></a>
290+
### func [NewArea](<https://github.com/atomicgo/cursor/blob/main/area.go#L17>)
267291

268292
```go
269293
func NewArea() Area
270294
```
271295

272296
NewArea returns a new Area.
273297

274-
### func \(\*Area\) [Clear](<https://github.com/atomicgo/cursor/blob/main/area.go#L20>)
298+
<a name="Area.Clear"></a>
299+
### func \(\*Area\) [Clear](<https://github.com/atomicgo/cursor/blob/main/area.go#L32>)
275300

276301
```go
277302
func (area *Area) Clear()
278303
```
279304

280305
Clear clears the content of the Area.
281306

282-
### func \(\*Area\) [Update](<https://github.com/atomicgo/cursor/blob/main/area.go#L28>)
307+
<a name="Area.Update"></a>
308+
### func \(\*Area\) [Update](<https://github.com/atomicgo/cursor/blob/main/area.go#L41>)
283309

284310
```go
285311
func (area *Area) Update(content string)
286312
```
287313

288314
Update overwrites the content of the Area.
289315

290-
## type [Writer](<https://github.com/atomicgo/cursor/blob/main/utils.go#L78-L81>)
316+
<a name="Area.WithWriter"></a>
317+
### func \(Area\) [WithWriter](<https://github.com/atomicgo/cursor/blob/main/area.go#L25>)
318+
319+
```go
320+
func (area Area) WithWriter(writer Writer) Area
321+
```
322+
323+
WithWriter sets a custom writer for the Area.
324+
325+
<a name="Writer"></a>
326+
## type [Writer](<https://github.com/atomicgo/cursor/blob/main/utils.go#L79-L82>)
291327

292328
Writer is an expanded io.Writer interface with a file descriptor.
293329

@@ -298,8 +334,6 @@ type Writer interface {
298334
}
299335
```
300336

301-
302-
303337
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
304338

305339

0 commit comments

Comments
 (0)