From 31c0726fcbd9b34e9434d19e6bbd79c3d9da87ea Mon Sep 17 00:00:00 2001 From: Jason Cheatham Date: Tue, 11 Jul 2017 09:54:36 -0400 Subject: [PATCH] Add shell-quote types --- types/shell-quote/index.d.ts | 12 ++++++++++++ types/shell-quote/shell-quote-tests.ts | 8 ++++++++ types/shell-quote/tsconfig.json | 22 ++++++++++++++++++++++ types/shell-quote/tslint.json | 1 + 4 files changed, 43 insertions(+) create mode 100644 types/shell-quote/index.d.ts create mode 100644 types/shell-quote/shell-quote-tests.ts create mode 100644 types/shell-quote/tsconfig.json create mode 100644 types/shell-quote/tslint.json diff --git a/types/shell-quote/index.d.ts b/types/shell-quote/index.d.ts new file mode 100644 index 0000000000..51e197618d --- /dev/null +++ b/types/shell-quote/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for shell-quote 1.6 +// Project: https://github.com/substack/node-shell-quote +// Definitions by: Jason Cheatham +// 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[]; diff --git a/types/shell-quote/shell-quote-tests.ts b/types/shell-quote/shell-quote-tests.ts new file mode 100644 index 0000000000..73b33be7a0 --- /dev/null +++ b/types/shell-quote/shell-quote-tests.ts @@ -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: '||' })); diff --git a/types/shell-quote/tsconfig.json b/types/shell-quote/tsconfig.json new file mode 100644 index 0000000000..f4db2c63ff --- /dev/null +++ b/types/shell-quote/tsconfig.json @@ -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 + } +} diff --git a/types/shell-quote/tslint.json b/types/shell-quote/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/shell-quote/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }