Initial commit
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
var shellescape = require('../');
|
||||
|
||||
var assert = require('assert');
|
||||
|
||||
var args = ['echo', 'hello!', 'how are you doing $USER', '"double"', "'single'"];
|
||||
|
||||
var escaped = shellescape(args);
|
||||
assert.strictEqual(escaped, "echo 'hello!' 'how are you doing $USER' '\"double\"' \\''single'\\'");
|
||||
console.log(escaped);
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
var shellescape = require('../');
|
||||
|
||||
var assert = require('assert');
|
||||
|
||||
var d = {
|
||||
"echo 'hello\\nworld'": ['echo', 'hello\\nworld'],
|
||||
"echo 'hello\\tworld'": ['echo', 'hello\\tworld'],
|
||||
"echo '\thello\nworld'\\'": ['echo', '\thello\nworld\''],
|
||||
"echo 'hello world'": ['echo', 'hello world'],
|
||||
"echo hello world": ['echo', 'hello', 'world'],
|
||||
"echo 'hello\\\\'\\' \\''\\\\'\\''world'": ["echo", "hello\\\\'", "'\\\\'world"],
|
||||
"echo hello 'world\\'": ["echo", "hello", "world\\"]
|
||||
};
|
||||
|
||||
Object.keys(d).forEach(function(s) {
|
||||
var escaped = shellescape(d[s]);
|
||||
assert.strictEqual(escaped, s);
|
||||
console.log(s);
|
||||
});
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
var shellescape = require('../');
|
||||
|
||||
var assert = require('assert');
|
||||
|
||||
var args = ['curl', '-v', '-H', 'Location;', '-H', 'User-Agent: dave#10', 'http://www.daveeddy.com/?name=dave&age=24'];
|
||||
|
||||
var escaped = shellescape(args);
|
||||
|
||||
assert.strictEqual(escaped, "curl -v -H 'Location;' -H 'User-Agent: dave#10' 'http://www.daveeddy.com/?name=dave&age=24'");
|
||||
console.log(escaped);
|
||||
Reference in New Issue
Block a user