Add shell-quote types

This commit is contained in:
Jason Cheatham
2017-07-11 09:54:36 -04:00
parent a656937358
commit 31c0726fcb
4 changed files with 43 additions and 0 deletions

12
types/shell-quote/index.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
// Type definitions for shell-quote 1.6
// Project: https://github.com/substack/node-shell-quote
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export function quote(args: string[]): string;
export function parse(
cmd: string,
env?: { [key: string]: string } | ((key: string) => string | object),
opts?: { [key: string]: string }
): string[];

View File

@@ -0,0 +1,8 @@
import { parse, quote } from 'shell-quote';
quote([ 'a', 'b c d', '$f', '"g"' ]);
parse('a "b c" \\$def \'it\\\'s great\'');
parse('beep --boop="$PWD"', { PWD: '/home/robot' });
parse('beep --boop="$PWD"', { PWD: '/home/robot' }, { escape: '^' });
parse('beep --boop="$PWD"', (key: string) => '/home/robot');
parse('beep --boop="$PWD"', (key: string) => ({ op: '||' }));

View File

@@ -0,0 +1,22 @@
{
"files": [
"index.d.ts",
"shell-quote-tests.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }