From 04b985e6aee64e1de2ce22aa8322b5033615eb8e Mon Sep 17 00:00:00 2001 From: simonhaenisch Date: Tue, 20 Aug 2019 01:01:18 +0200 Subject: [PATCH] feat: set process and xterm title --- cli.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cli.ts b/cli.ts index ac9dcf7..2622d09 100755 --- a/cli.ts +++ b/cli.ts @@ -50,6 +50,8 @@ const cliFlags = arg({ // Main async function main(args: typeof cliFlags, config: Config) { + setProcessAndTermTitle('md-to-pdf'); + if (args['--version']) { return console.log(require('./package').version); } @@ -111,6 +113,11 @@ async function main(args: typeof cliFlags, config: Config) { .catch((error: Error) => (args['--debug'] && console.error(error)) || process.exit(1)); } +function setProcessAndTermTitle(title: string) { + process.title = title; + process.stdout.write(`${String.fromCharCode(27)}]0;${title}${String.fromCharCode(7)}`); +} + // -- // Run