Skip to content

Commit e3080a4

Browse files
author
Joe Skeen
committed
Definitions for gulp-task-listing
1 parent 32029fc commit e3080a4

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// <reference path="../gulp/gulp.d.ts" />
2+
/// <reference path="gulp-task-listing.d.ts" />
3+
4+
import gulp = require('gulp');
5+
import gulpTaskListing = require('gulp-task-listing');
6+
7+
gulp.task('help-default', gulpTaskListing);
8+
gulp.task('help-subTaskRegexFilter', gulpTaskListing.withFilters(/\d+/));
9+
gulp.task('help-subTaskFunctionFilter', gulpTaskListing.withFilters(task => task.length > 3));
10+
gulp.task('help-excludeRegexFilter', gulpTaskListing.withFilters(null, /\w+/));
11+
gulp.task('help-excludeFunctionFilter', gulpTaskListing.withFilters(null, task => task.length < 2));
12+
gulp.task('help-bothFilters1', gulpTaskListing.withFilters(/\d+/, /\w+/));
13+
gulp.task('help-bothFilters2', gulpTaskListing.withFilters(/\d+/, task => task.length > 3));
14+
gulp.task('help-bothFilters3', gulpTaskListing.withFilters(task => task.length < 2, /\w+/));
15+
gulp.task('help-bothFilters4', gulpTaskListing.withFilters(task => task.length < 2, task => task.length > 3));
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Type definitions for gulp-task-listing
2+
// Project: https://github.com/OverZealous/gulp-task-listing
3+
// Definitions by: Joe Skeen <http://github.com/joeskeen>
4+
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5+
6+
/**
7+
* Provides an easy way to get a listing of your tasks from your gulpfile. By default, the
8+
* output groups tasks based on whether or not they contain a hyphen (-), underscore (_),
9+
* or colon (:) in their name.
10+
*
11+
* You can optionally override the Regexp used to determine whether a task is a primary or
12+
* subtask, as well as filter out tasks you don't want to see in the output.
13+
*/
14+
declare module 'gulp-task-listing' {
15+
16+
/**
17+
* Provides an easy way to get a listing of your tasks from your gulpfile. By default, the
18+
* output groups tasks based on whether or not they contain a hyphen (-), underscore (_),
19+
* or colon (:) in their name.
20+
*
21+
* You can optionally override the Regexp used to determine whether a task is a primary or
22+
* subtask, as well as filter out tasks you don't want to see in the output.
23+
*/
24+
interface GulpTaskListing {
25+
(cb): void;
26+
/**
27+
* Allows for custom filtering of Gulp tasks in the listing
28+
*
29+
* @param subTaskFilter a RegExp or Function returning whether the given task is a subtask
30+
* @param excludeFilter a RegExp or Function returning whether the given task should be excluded from the listing
31+
*/
32+
withFilters(subTaskFilter: RegExp | FilterFunction, excludeFilter?: RegExp | FilterFunction): (cb) => void;
33+
}
34+
35+
type FilterFunction = (task: string) => boolean;
36+
37+
var gulpTaskListing: GulpTaskListing;
38+
39+
export = gulpTaskListing;
40+
}

0 commit comments

Comments
 (0)