1 | #!/usr/bin/env node
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | "use strict" ;
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | var termkit = require( '../lib/termkit.js' ) ;
|
37 | var term = termkit.terminal ;
|
38 |
|
39 | async function detect() {
|
40 | term.green( '\n== Environment variable ==\n\n' ) ;
|
41 | term( '$TERM: %s\n' , process.env.TERM ) ;
|
42 | term( '$COLORTERM: %s\n' , process.env.COLORTERM ) ;
|
43 | term( '$VTE_VERSION: %s\n' , process.env.VTE_VERSION ) ;
|
44 | term( '\n' ) ;
|
45 |
|
46 |
|
47 |
|
48 | term.green( '\n== Using simple terminal guessing ==\n\n' ) ;
|
49 | term( '.guessTerminal(): %J\n' , termkit.guessTerminal() ) ;
|
50 | term( 'Terminal name: %s\n' , term.appName ) ;
|
51 | term( 'Terminal app ID: %s\n' , term.appId ) ;
|
52 | term( 'Generic terminal: %s\n' , term.generic ) ;
|
53 | term( 'Config file: %s\n' , term.termconfigFile ) ;
|
54 | term( '\n' ) ;
|
55 |
|
56 |
|
57 |
|
58 | term.green( '\n== Using advanced terminal detection ==\n\n' ) ;
|
59 | var info = await termkit.getParentTerminalInfo( info ) ;
|
60 |
|
61 | term( '.getParentTerminalInfo(): %J\n' , info ) ;
|
62 |
|
63 | var newTerm = await termkit.getDetectedTerminal() ;
|
64 |
|
65 | term( 'Terminal name: %s\n' , newTerm.appName ) ;
|
66 | term( 'Terminal app ID: %s\n' , newTerm.appId ) ;
|
67 | term( 'Generic terminal: %s\n' , newTerm.generic ) ;
|
68 | term( 'Config file: %s\n' , newTerm.termconfigFile ) ;
|
69 | term( '\n' ) ;
|
70 | }
|
71 |
|
72 | detect() ;
|