Code Monkey home page Code Monkey logo

Comments (11)

yocontra avatar yocontra commented on July 23, 2024

If somebody wants to make the autocomplete files (these https://github.com/gruntjs/grunt-cli/tree/master/completion) for gulp I would be open to accepting a PR

from gulp.

floatdrop avatar floatdrop commented on July 23, 2024

This will need more investigation, than I thought at first. Gulp cli do not lists tasks in "--help", so way that grunt does autocompletion (greps help output) is not suitable. But it can be done, if we manage write this autocompletion script in node - if this is possible, then all that we need is require gulpfile.js and list its this.tasks.

P.s. May be it's possible to fetch tasks from one-liner: node -e "console.log(require('{$GULPFILE}').tasks.join(' '))"

from gulp.

yocontra avatar yocontra commented on July 23, 2024

@floatdrop That seems like the easiest solution

from gulp.

robrich avatar robrich commented on July 23, 2024

this.tasks is an object of more than just names. It seems like orchestrator could benefit from a .taskNames() that harvested that list though.

from gulp.

yocontra avatar yocontra commented on July 23, 2024

@robrich node -e "console.log(Object.keys(require('{$GULPFILE}').tasks).join(' '))" will probably be good enough. No need to add more API surface to support edge cases

from gulp.

floatdrop avatar floatdrop commented on July 23, 2024

Too bad, that gulpfile.js do not exposes nothing (since there is no exports in it).

from gulp.

sindresorhus avatar sindresorhus commented on July 23, 2024

@floatdrop what would it export?

from gulp.

floatdrop avatar floatdrop commented on July 23, 2024

@sindresorhus gulp instance would be enough - after you get it, you can access his .task property and extract tasks names from it.

from gulp.

sindresorhus avatar sindresorhus commented on July 23, 2024

@floatdrop somewhat hacky, but something like this should do it:

var gulp = require('require-modify')('./gulpfile', function (src) {
    return src + ';module.exports = gulp;';
});

the beginning ; is in case the user have forgotten a semicolon on the last statement

https://github.com/sindresorhus/require-modify

from gulp.

timrwood avatar timrwood commented on July 23, 2024

Because the gulp object is a singleton, couldn't you do this as well?

var gulp = require('gulp');
require('./gulpfile');
console.log(Object.keys(gulp.tasks).join(' '));

from gulp.

floatdrop avatar floatdrop commented on July 23, 2024

@timrwood cool! This will do the trick node -e "var gulp = require('gulp'); require('./gulpfile'); console.log(Object.keys(gulp.tasks).join(' '));"

from gulp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.