Question: I have a question regarding a select mysql query. Lets say that we have 2 tables

users: [ id, username ]
logs [ id, user\_id, action ]

I want to selecr all users from table users with the count(`id`) of table logs based on user\_id

I tried to do the following:

```
SELECT t1.*,count(t2.`id`) 
FROM `users` t1
LEFT JOIN `logs` t2 
ON  t1.id = t2.user_id;

```

But that only prints the users who have count logs > 0. I want to select all the users with the count of the logs.

Answer: 
**Edit**

`gulp-util` is [deprecated](https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5) and should be avoid, so it's recommended to use [minimist](https://www.npmjs.com/package/minimist) instead, which `gulp-util` already used.

So I've changed some lines in my gulpfile to remove `gulp-util`:

```
var argv = require('minimist')(process.argv.slice(2));

gulp.task('styles', function() {
  return gulp.src(['src/styles/' + (argv.theme || 'main') + '.scss'])
    …
});

```

**Original**

In my project I use the following flag:

```
gulp styles --theme literature

```

Gulp offers an object `gulp.env` for that. It's deprecated in newer versions, so you must use gulp-util for that. The tasks looks like this:

```
var util = require('gulp-util');

gulp.task('styles', function() {
  return gulp.src(['src/styles/' + (util.env.theme ? util.env.theme : 'main') + '.scss'])
    .pipe(compass({
        config_file: './config.rb',
        sass   : 'src/styles',
        css    : 'dist/styles',
        style  : 'expanded'

    }))
    .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'ff 17', 'opera 12.1', 'ios 6', 'android 4'))
    .pipe(livereload(server))
    .pipe(gulp.dest('dist/styles'))
    .pipe(notify({ message: 'Styles task complete' }));
});

```

The environment setting is available during all subtasks. So I can use this flag on the watch task too:

```
gulp watch --theme literature

```

And my styles task also works.

Ciao
Ralf
It has been some time since this question has been posted, but maybe it will help someone. 

I am using GULP CLI 2.0.1 (installed globally) and GULP 4.0.0 (installed locally) here is how you do it without any additional plugin. I think the code is quite self-explanatory.

```
var cp = require('child_process'), 
{ src, dest, series, parallel, watch } = require('gulp');

// == availableTasks: log available tasks to console
function availableTasks(done) {
  var command = 'gulp --tasks-simple';
  if (process.argv.indexOf('--verbose') > -1) {
    command = 'gulp --tasks';
  }
  cp.exec(command, function(err, stdout, stderr) {
    done(console.log('Available tasks are:\n' + stdout));
  });
}
availableTasks.displayName = 'tasks';
availableTasks.description = 'Log available tasks to console as plain text list.';
availableTasks.flags = {
  '--verbose': 'Display tasks dependency tree instead of plain text list.'
};
exports.availableTasks = availableTasks;

```

And run from the console:

```
gulp availableTasks

```

Then run and see the differences:

```
gulp availableTasks --verbose

```