mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-15 09:37:52 +08:00
Type definitions and tests for git-config
This commit is contained in:
11
git-config/git-config-async-tests.ts
Normal file
11
git-config/git-config-async-tests.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/// <reference path="git-config-async.d.ts" />
|
||||
|
||||
import gitConfig = require('git-config');
|
||||
|
||||
gitConfig(function(err: any, config: Object) {
|
||||
console.log(JSON.stringify(config));
|
||||
});
|
||||
|
||||
gitConfig('gitconfig', function(err: any, config: Object) {
|
||||
console.log(JSON.stringify(config));
|
||||
});
|
||||
9
git-config/git-config-async.d.ts
vendored
Normal file
9
git-config/git-config-async.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
// Type definitions for git-config
|
||||
// Project: https://github.com/eugeneware/git-config
|
||||
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "git-config" {
|
||||
function gitConfig(gitFile_or_cb: any, cb?: any): void; // Asynchronous version.
|
||||
export = gitConfig;
|
||||
}
|
||||
9
git-config/git-config-tests.ts
Normal file
9
git-config/git-config-tests.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/// <reference path="git-config.d.ts" />
|
||||
|
||||
import gitConfig = require('git-config');
|
||||
|
||||
var config: Object = gitConfig.sync(); // => Object if .gitconfig exists.
|
||||
console.log(JSON.stringify(config));
|
||||
|
||||
config = gitConfig.sync('gitconfig'); // => Object as gitconfig definitely exists.
|
||||
console.log(JSON.stringify(config));
|
||||
8
git-config/git-config.d.ts
vendored
Normal file
8
git-config/git-config.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// Type definitions for git-config
|
||||
// Project: https://github.com/eugeneware/git-config
|
||||
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "git-config" {
|
||||
export function sync(gitFile?: string): Object; // Synchronous version.
|
||||
}
|
||||
Reference in New Issue
Block a user