Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readline.d.ts 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. declare module 'readline' {
  2. import EventEmitter = require('events');
  3. interface Key {
  4. sequence?: string;
  5. name?: string;
  6. ctrl?: boolean;
  7. meta?: boolean;
  8. shift?: boolean;
  9. }
  10. class Interface extends EventEmitter {
  11. readonly terminal: boolean;
  12. // Need direct access to line/cursor data, for use in external processes
  13. // see: https://github.com/nodejs/node/issues/30347
  14. /** The current input data */
  15. readonly line: string;
  16. /** The current cursor position in the input line */
  17. readonly cursor: number;
  18. /**
  19. * NOTE: According to the documentation:
  20. *
  21. * > Instances of the `readline.Interface` class are constructed using the
  22. * > `readline.createInterface()` method.
  23. *
  24. * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
  25. */
  26. protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean);
  27. /**
  28. * NOTE: According to the documentation:
  29. *
  30. * > Instances of the `readline.Interface` class are constructed using the
  31. * > `readline.createInterface()` method.
  32. *
  33. * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
  34. */
  35. protected constructor(options: ReadLineOptions);
  36. setPrompt(prompt: string): void;
  37. prompt(preserveCursor?: boolean): void;
  38. question(query: string, callback: (answer: string) => void): void;
  39. pause(): this;
  40. resume(): this;
  41. close(): void;
  42. write(data: string | Buffer, key?: Key): void;
  43. /**
  44. * Returns the real position of the cursor in relation to the input
  45. * prompt + string. Long input (wrapping) strings, as well as multiple
  46. * line prompts are included in the calculations.
  47. */
  48. getCursorPos(): CursorPos;
  49. /**
  50. * events.EventEmitter
  51. * 1. close
  52. * 2. line
  53. * 3. pause
  54. * 4. resume
  55. * 5. SIGCONT
  56. * 6. SIGINT
  57. * 7. SIGTSTP
  58. */
  59. addListener(event: string, listener: (...args: any[]) => void): this;
  60. addListener(event: "close", listener: () => void): this;
  61. addListener(event: "line", listener: (input: string) => void): this;
  62. addListener(event: "pause", listener: () => void): this;
  63. addListener(event: "resume", listener: () => void): this;
  64. addListener(event: "SIGCONT", listener: () => void): this;
  65. addListener(event: "SIGINT", listener: () => void): this;
  66. addListener(event: "SIGTSTP", listener: () => void): this;
  67. emit(event: string | symbol, ...args: any[]): boolean;
  68. emit(event: "close"): boolean;
  69. emit(event: "line", input: string): boolean;
  70. emit(event: "pause"): boolean;
  71. emit(event: "resume"): boolean;
  72. emit(event: "SIGCONT"): boolean;
  73. emit(event: "SIGINT"): boolean;
  74. emit(event: "SIGTSTP"): boolean;
  75. on(event: string, listener: (...args: any[]) => void): this;
  76. on(event: "close", listener: () => void): this;
  77. on(event: "line", listener: (input: string) => void): this;
  78. on(event: "pause", listener: () => void): this;
  79. on(event: "resume", listener: () => void): this;
  80. on(event: "SIGCONT", listener: () => void): this;
  81. on(event: "SIGINT", listener: () => void): this;
  82. on(event: "SIGTSTP", listener: () => void): this;
  83. once(event: string, listener: (...args: any[]) => void): this;
  84. once(event: "close", listener: () => void): this;
  85. once(event: "line", listener: (input: string) => void): this;
  86. once(event: "pause", listener: () => void): this;
  87. once(event: "resume", listener: () => void): this;
  88. once(event: "SIGCONT", listener: () => void): this;
  89. once(event: "SIGINT", listener: () => void): this;
  90. once(event: "SIGTSTP", listener: () => void): this;
  91. prependListener(event: string, listener: (...args: any[]) => void): this;
  92. prependListener(event: "close", listener: () => void): this;
  93. prependListener(event: "line", listener: (input: string) => void): this;
  94. prependListener(event: "pause", listener: () => void): this;
  95. prependListener(event: "resume", listener: () => void): this;
  96. prependListener(event: "SIGCONT", listener: () => void): this;
  97. prependListener(event: "SIGINT", listener: () => void): this;
  98. prependListener(event: "SIGTSTP", listener: () => void): this;
  99. prependOnceListener(event: string, listener: (...args: any[]) => void): this;
  100. prependOnceListener(event: "close", listener: () => void): this;
  101. prependOnceListener(event: "line", listener: (input: string) => void): this;
  102. prependOnceListener(event: "pause", listener: () => void): this;
  103. prependOnceListener(event: "resume", listener: () => void): this;
  104. prependOnceListener(event: "SIGCONT", listener: () => void): this;
  105. prependOnceListener(event: "SIGINT", listener: () => void): this;
  106. prependOnceListener(event: "SIGTSTP", listener: () => void): this;
  107. [Symbol.asyncIterator](): AsyncIterableIterator<string>;
  108. }
  109. type ReadLine = Interface; // type forwarded for backwards compatibility
  110. type Completer = (line: string) => CompleterResult;
  111. type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => any;
  112. type CompleterResult = [string[], string];
  113. interface ReadLineOptions {
  114. input: NodeJS.ReadableStream;
  115. output?: NodeJS.WritableStream;
  116. completer?: Completer | AsyncCompleter;
  117. terminal?: boolean;
  118. historySize?: number;
  119. prompt?: string;
  120. crlfDelay?: number;
  121. removeHistoryDuplicates?: boolean;
  122. escapeCodeTimeout?: number;
  123. tabSize?: number;
  124. }
  125. function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
  126. function createInterface(options: ReadLineOptions): Interface;
  127. function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
  128. type Direction = -1 | 0 | 1;
  129. interface CursorPos {
  130. rows: number;
  131. cols: number;
  132. }
  133. /**
  134. * Clears the current line of this WriteStream in a direction identified by `dir`.
  135. */
  136. function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
  137. /**
  138. * Clears this `WriteStream` from the current cursor down.
  139. */
  140. function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
  141. /**
  142. * Moves this WriteStream's cursor to the specified position.
  143. */
  144. function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
  145. /**
  146. * Moves this WriteStream's cursor relative to its current position.
  147. */
  148. function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
  149. }