Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce support for running multiple tasks in series #39

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tunnckoCore
Copy link
Contributor

Because why not? It's easy addition.

Example (seen even in the maid's npm scripts)

maid lint test build

# equivalent of
maid lint && maid test && maid build

@egoist
Copy link
Owner

egoist commented Jun 6, 2018

I guess this is unnecessary and it will be impossible to pass arguments to the task. https://github.com/egoist/maid#read-command-line-arguments

@tunnckoCore
Copy link
Contributor Author

Yes. But this also may be a problem i'm describing here #37 (comment)

What if CLI that you run from task have also such task?

Let's consider an example that CLi that you want to run have command and optional sub-command such signature like yarn help add. Currently if want to run only yarn help from a task named add in your maidfile (e.g. maid add), it will actually run yarn help add :D Of course, this example is very specific, but just to get the point.

## add

Some description

```sh
yarn help
```

@tunnckoCore
Copy link
Contributor Author

tunnckoCore commented Jun 6, 2018

I just thought... We can allow running multiple commands behind maid run task1 [task2] [task3] command or through --run flag e.g. maid --run task1 task2 task3 - which btw can't be workarounded here even with = after the --run, until we are kind of forced to use maid --run=task1,task2,task3 (because how cac works).

But yea, you are kind of right, because we can use such maidfile to accomplish "run in series".

## full

```sh
maid lint && maid test && maid build 
```

## lint

```sh
eslint src
```

## test

```sh
ava tests/
```

## build

```sh
babel src -d dist
```

so then just maid full

@tunnckoCore
Copy link
Contributor Author

tunnckoCore commented Jun 6, 2018

Building a task runner is a bit tricky some times. I know what it is, because I'm facing such problems, decisions and ideas while building v3 of hela.
Should pay some trade-offs. But i'm based on sade so don't have much problems, even can have sub-commands/sub-tasks without any problems - can have such descriptive definition of tasks

I've workedaround those conflicting by filtering out hela's flags, so they are not passed to the executed command.

So to recap. We can close, your decision :)

@v-trof
Copy link

v-trof commented Jun 6, 2018

You might get even fancier with maidfile.md

## full
Run tasks `one` `two` `three` after this

## one
```js
console.log(1)
```

## two
```js
console.log(2)
```

## three
```js
console.log(3)
```

Though something like

## full
Run tasks <tasks>

(no this, no before \ after)
that resuls in

starting full
starting one
finished one

starting two
finished two

starting three
finished three

finished full

Might be really handy sytax sugar that would still allow for arguments and easy to type command

@tunnckoCore
Copy link
Contributor Author

@vsevolodtrofimov mmm yeah. More and more considering that this PR can be closed. The point of markdown-driven task runner is to use markdown insead of cli for most of things (such like running multiple commands/tasks)

@jakepearson
Copy link
Collaborator

@tunnckoCore I have access to start merging, would you fix the conflicts and I will merge today. Thanks.

@tunnckoCore
Copy link
Contributor Author

tunnckoCore commented Oct 9, 2018

What conflicts? There are no conflicts.

The thing is that i'm still not sure if we want this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants