Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: misterfifths/jutil
base: 434e18a4e1
...
head fork: misterfifths/jutil
compare: 7386a2ac51
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 15 additions and 3 deletions.
  1. +15 −3 jutil.js
View
18 jutil.js
@@ -822,6 +822,8 @@ function outputString(str, runtimeSettings, config)
var buffer,
lineCount,
pagerCmd,
+ pagerSplit,
+ pagerArgs = [],
pager;
if(runtimeSettings.smartOutput) {
@@ -829,9 +831,16 @@ function outputString(str, runtimeSettings, config)
if(lineCount > process.stdout.getWindowSize()[1]) {
// Autopage
pagerCmd = process.env.PAGER || 'less';
+
+ // TODO: this is a pretty naive processing of arguments embedded in $PAGER
+ if(pagerCmd.indexOf(' ') != -1) {
+ pagerSplit = pagerCmd.split(' ');
+ pagerCmd = pagerSplit[0];
+ pagerArgs = pagerSplit.slice(1);
+ }
pager = require('child_process')
- .spawn(pagerCmd, [], {
+ .spawn(pagerCmd, pagerArgs, {
customFds: [-1, process.stdout.fd, -1]
});
@@ -1017,15 +1026,18 @@ function parseCommandLine(commands)
wrap = require('wordwrap')(width);
str = wrap(str) + '\n';
- code == code || 0;
+ code = code || 0;
- if(code == 0)
+ if(code === 0)
process.stdout.write(str);
else
process.stderr.write(str);
process.exit(code);
});
+
+ if(require('tty').isatty(process.stdout.fd))
+ parser.colors();
parser
.nocommand()

No commit comments for this range

Something went wrong with that request. Please try again.