+10
-6
@@ -42,2 +42,3 @@ #!/usr/bin/env node | ||
| .option('-n --number <n>', 'number of suggestions', Number, 5) | ||
| .option('-v --verbose', 'print cd command', false) | ||
| .option('-a --auto', 'automatically cd if there is only one result', false) | ||
@@ -54,3 +55,2 @@ .on('--help', function(){ | ||
| // cleanup function | ||
@@ -61,8 +61,10 @@ var exit = function(x, y, output){ | ||
| charm.position(0,y); | ||
| charm.cursor(true); | ||
| if (output) { | ||
| charm.write('cd "'+output+'"\n'); | ||
| if(opts.verbose) charm.write('cd "'+output+'"\n'); | ||
| process.stderr.write(output); | ||
| } | ||
| charm.cursor(true); | ||
| process.exit(); | ||
| process.nextTick(function(){ | ||
| process.exit(); | ||
| }); | ||
| } | ||
@@ -100,3 +102,3 @@ | ||
| charm.position(1+prompt.length+buffer.length, y); | ||
| } else if (key && (key.name == "enter" || (key.ctrl && key.name == 'c'))){ | ||
| } else if (key && (key.name == "enter" || (key.ctrl && (key.name == 'c' || key.name == 'd')))){ | ||
| exit(x,y,key.name=="enter"?suggestions.get():null); | ||
@@ -122,3 +124,5 @@ } else if (!key || !key.ctrl){ | ||
| suggestions.update(res); | ||
| if (opts.auto && res.length==1) exit(x,y,suggestions.get()); | ||
| suggestions.render(function(){ | ||
| if (opts.auto && res.length==1) exit(x,y,suggestions.get()); | ||
| }); | ||
| }); | ||
@@ -125,0 +129,0 @@ } |
@@ -23,3 +23,2 @@ var util = require('util'); | ||
| this.length = newSuggestions.length; | ||
| this.render(); | ||
| }; | ||
@@ -47,3 +46,3 @@ | ||
| Suggestions.prototype.render = function(){ | ||
| Suggestions.prototype.render = function(callback){ | ||
| var size = process.stdout.getWindowSize(), | ||
@@ -69,2 +68,3 @@ lines = size[0], | ||
| charm.position(x,y).cursor(true); | ||
| callback(); | ||
| }.bind(this)); | ||
@@ -71,0 +71,0 @@ }; |
+2
-2
@@ -5,3 +5,3 @@ { | ||
| "description": "autosuggest change directory", | ||
| "version": "0.0.7", | ||
| "version": "0.0.8", | ||
| "repository": { | ||
@@ -25,2 +25,2 @@ "url": "git://github.com/afriggeri/jump.git" | ||
| "preferGlobal": true | ||
| } | ||
| } |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
75276
0.26%203
2.53%