diff --git a/types/osenv/index.d.ts b/types/osenv/index.d.ts new file mode 100644 index 0000000000..42765e8655 --- /dev/null +++ b/types/osenv/index.d.ts @@ -0,0 +1,47 @@ +// Type definitions for osenv 0.1 +// Project: https://github.com/npm/osenv +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * The machine name. Calls hostname if not found. + */ +export function hostname(cb?: (hostname: string, error?: string) => void): string; + +/** + * The currently logged-in user. Calls whoami if not found. + */ +export function user(cb?: (user: string, error?: string) => void): string; + +/** + * Either PS1 on unix, or PROMPT on Windows. + */ +export function prompt(cb?: (prompt: string, error?: string) => void): string; + +/** + * The place where temporary files should be created. + */ +export function tmpdir(cb?: (tmpdir: string, error?: string) => void): string; + +/** + * No place like it. + */ +export function home(cb?: (home: string, error?: string) => void): string; + +/** + * An array of the places that the operating system will search for executables. + */ +export function path(cb?: (path: string, error?: string) => void): string; + +/** + * Return the executable name of the editor program. + * This uses the EDITOR and VISUAL environment variables, + * and falls back to vi on Unix, or notepad.exe on Windows. + */ +export function editor(cb?: (editor: string, error?: string) => void): string; + +/** + * The SHELL on Unix, which Windows calls the ComSpec. + * Defaults to 'bash' or 'cmd'. + */ +export function shell(cb?: (shell: string, error?: string) => void): string; diff --git a/types/osenv/osenv-tests.ts b/types/osenv/osenv-tests.ts new file mode 100644 index 0000000000..c3bf7333af --- /dev/null +++ b/types/osenv/osenv-tests.ts @@ -0,0 +1,25 @@ +import osenv = require("osenv"); + +osenv.hostname(); +osenv.hostname((er, hostname) => {}); + +osenv.home(); +osenv.home((er, home) => {}); + +osenv.editor(); +osenv.editor((er, editor) => {}); + +osenv.path(); +osenv.path((er, path) => {}); + +osenv.prompt(); +osenv.prompt((er, prompt) => {}); + +osenv.shell(); +osenv.shell((er, shell) => {}); + +osenv.tmpdir(); +osenv.tmpdir((er, tmpdir) => {}); + +osenv.user(); +osenv.user((er, user) => {}); diff --git a/types/osenv/tsconfig.json b/types/osenv/tsconfig.json new file mode 100644 index 0000000000..0ef638e38e --- /dev/null +++ b/types/osenv/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "osenv-tests.ts" + ] +} diff --git a/types/osenv/tslint.json b/types/osenv/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/osenv/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file