Ohm-Management - Projektarbeit B-ME
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.

index.d.ts 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /***
  2. * Node External Editor
  3. *
  4. * Kevin Gravier <kevin@mrkmg.com>
  5. * MIT 2018
  6. */
  7. import { CreateFileError } from "./errors/CreateFileError";
  8. import { LaunchEditorError } from "./errors/LaunchEditorError";
  9. import { ReadFileError } from "./errors/ReadFileError";
  10. import { RemoveFileError } from "./errors/RemoveFileError";
  11. export interface IEditorParams {
  12. args: string[];
  13. bin: string;
  14. }
  15. export declare type StringCallback = (err: Error, result: string) => void;
  16. export declare type VoidCallback = () => void;
  17. export { CreateFileError, LaunchEditorError, ReadFileError, RemoveFileError };
  18. export declare function edit(text?: string): string;
  19. export declare function editAsync(text: string, callback: StringCallback): void;
  20. export declare class ExternalEditor {
  21. private static splitStringBySpace;
  22. text: string;
  23. tempFile: string;
  24. editor: IEditorParams;
  25. lastExitStatus: number;
  26. readonly temp_file: string;
  27. readonly last_exit_status: number;
  28. constructor(text?: string);
  29. run(): string;
  30. runAsync(callback: StringCallback): void;
  31. cleanup(): void;
  32. private determineEditor;
  33. private createTemporaryFile;
  34. private readTemporaryFile;
  35. private removeTemporaryFile;
  36. private launchEditor;
  37. private launchEditorAsync;
  38. }