source: trip-planner-front/node_modules/ansi-escapes/readme.md@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.9 KB
Line 
1# ansi-escapes
2
3> [ANSI escape codes](http://www.termsys.demon.co.uk/vtansi.htm) for manipulating the terminal
4
5## Install
6
7```
8$ npm install ansi-escapes
9```
10
11## Usage
12
13```js
14const ansiEscapes = require('ansi-escapes');
15
16// Moves the cursor two rows up and to the left
17process.stdout.write(ansiEscapes.cursorUp(2) + ansiEscapes.cursorLeft);
18//=> '\u001B[2A\u001B[1000D'
19```
20
21## API
22
23### cursorTo(x, y?)
24
25Set the absolute position of the cursor. `x0` `y0` is the top left of the screen.
26
27### cursorMove(x, y?)
28
29Set the position of the cursor relative to its current position.
30
31### cursorUp(count)
32
33Move cursor up a specific amount of rows. Default is `1`.
34
35### cursorDown(count)
36
37Move cursor down a specific amount of rows. Default is `1`.
38
39### cursorForward(count)
40
41Move cursor forward a specific amount of columns. Default is `1`.
42
43### cursorBackward(count)
44
45Move cursor backward a specific amount of columns. Default is `1`.
46
47### cursorLeft
48
49Move cursor to the left side.
50
51### cursorSavePosition
52
53Save cursor position.
54
55### cursorRestorePosition
56
57Restore saved cursor position.
58
59### cursorGetPosition
60
61Get cursor position.
62
63### cursorNextLine
64
65Move cursor to the next line.
66
67### cursorPrevLine
68
69Move cursor to the previous line.
70
71### cursorHide
72
73Hide cursor.
74
75### cursorShow
76
77Show cursor.
78
79### eraseLines(count)
80
81Erase from the current cursor position up the specified amount of rows.
82
83### eraseEndLine
84
85Erase from the current cursor position to the end of the current line.
86
87### eraseStartLine
88
89Erase from the current cursor position to the start of the current line.
90
91### eraseLine
92
93Erase the entire current line.
94
95### eraseDown
96
97Erase the screen from the current line down to the bottom of the screen.
98
99### eraseUp
100
101Erase the screen from the current line up to the top of the screen.
102
103### eraseScreen
104
105Erase the screen and move the cursor the top left position.
106
107### scrollUp
108
109Scroll display up one line.
110
111### scrollDown
112
113Scroll display down one line.
114
115### clearScreen
116
117Clear the terminal screen. (Viewport)
118
119### clearTerminal
120
121Clear the whole terminal, including scrollback buffer. (Not just the visible part of it)
122
123### beep
124
125Output a beeping sound.
126
127### link(text, url)
128
129Create a clickable link.
130
131[Supported terminals.](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) Use [`supports-hyperlinks`](https://github.com/jamestalmage/supports-hyperlinks) to detect link support.
132
133### image(filePath, options?)
134
135Display an image.
136
137*Currently only supported on iTerm2 >=3*
138
139See [term-img](https://github.com/sindresorhus/term-img) for a higher-level module.
140
141#### input
142
143Type: `Buffer`
144
145Buffer of an image. Usually read in with `fs.readFile()`.
146
147#### options
148
149Type: `object`
150
151##### width
152##### height
153
154Type: `string | number`
155
156The width and height are given as a number followed by a unit, or the word "auto".
157
158- `N`: N character cells.
159- `Npx`: N pixels.
160- `N%`: N percent of the session's width or height.
161- `auto`: The image's inherent size will be used to determine an appropriate dimension.
162
163##### preserveAspectRatio
164
165Type: `boolean`\
166Default: `true`
167
168### iTerm.setCwd(path?)
169
170Type: `string`\
171Default: `process.cwd()`
172
173[Inform iTerm2](https://www.iterm2.com/documentation-escape-codes.html) of the current directory to help semantic history and enable [Cmd-clicking relative paths](https://coderwall.com/p/b7e82q/quickly-open-files-in-iterm-with-cmd-click).
174
175### iTerm.annotation(message, options?)
176
177Creates an escape code to display an "annotation" in iTerm2.
178
179An annotation looks like this when shown:
180
181<img src="https://user-images.githubusercontent.com/924465/64382136-b60ac700-cfe9-11e9-8a35-9682e8dc4b72.png" width="500">
182
183See the [iTerm Proprietary Escape Codes documentation](https://iterm2.com/documentation-escape-codes.html) for more information.
184
185#### message
186
187Type: `string`
188
189The message to display within the annotation.
190
191The `|` character is disallowed and will be stripped.
192
193#### options
194
195Type: `object`
196
197##### length
198
199Type: `number`\
200Default: The remainder of the line
201
202Nonzero number of columns to annotate.
203
204##### x
205
206Type: `number`\
207Default: Cursor position
208
209Starting X coordinate.
210
211Must be used with `y` and `length`.
212
213##### y
214
215Type: `number`\
216Default: Cursor position
217
218Starting Y coordinate.
219
220Must be used with `x` and `length`.
221
222##### isHidden
223
224Type: `boolean`\
225Default: `false`
226
227Create a "hidden" annotation.
228
229Annotations created this way can be shown using the "Show Annotations" iTerm command.
230
231## Related
232
233- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
234
235---
236
237<div align="center">
238 <b>
239 <a href="https://tidelift.com/subscription/pkg/npm-ansi-escapes?utm_source=npm-ansi-escapes&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
240 </b>
241 <br>
242 <sub>
243 Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
244 </sub>
245</div>
Note: See TracBrowser for help on using the repository browser.