forked from sjurba/rebase-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·48 lines (44 loc) · 1000 Bytes
/
Copy pathindex.js
File metadata and controls
executable file
·48 lines (44 loc) · 1000 Bytes
1
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env node
'use strict';
const term = require('terminal-kit').terminal,
FileHandle = require('./lib/file-handle'),
main = require('./lib/main');
const args = require('minimist')(process.argv, {
boolean: ['s', 'alternate-screen'],
alias: {
s: 'status',
k: 'keys',
c: 'colors',
m: 'marker'
},
default: {
'alternate-screen': true
}
});
if (args._.length < 3) {
console.error('No input file specified.');
process.exit(1);
}
const file = args._[args._.length - 1];
let marker = args.marker;
if (!marker && process.platform === 'win32') {
// Windows CMD and PowerShell dosn't support ANSI Inverse.
marker = '^Y';
}
const progArgs = {
status: args.status,
keys: args.keys,
colors: args.colors,
selectMarker: marker || '^!',
alternateScreen: args['alternate-screen'],
file: new FileHandle(file),
term: term
};
main(progArgs, (err) => {
let status = 0;
if (err) {
console.error(err);
status = 1;
}
process.exit(status);
});