maid icon indicating copy to clipboard operation
maid copied to clipboard

Global Variables

Open raguay opened this issue 7 years ago • 8 comments

In a maidfile, it would be nice to have some variables set so that they can be referenced in the other scripts. Therefore, if the following was at the top:

## global

```bash
destdir='~/.dest'
```

```js
 var destdir='~/.dest'
```

Then the variable $destdir can be used in all the other bash scripts. Have the same thing for js scripts also.

The four spaces won. Using 4 tick didn't help.

raguay avatar Jun 01 '18 04:06 raguay

Just as an FYI, you can indent each line with 4 spaces instead of using the 3 ` notation.

## global

```bash
destdir='~/.dest'
```

```js
 var destdir='~/.dest'
```

saadq avatar Jun 01 '18 14:06 saadq

or use 4 backticks for the markdown block if you want syntax highlighting:

carbon 45

egoist avatar Jun 01 '18 14:06 egoist

Probably a bit related to the #6. If we implement it with VM, we can pass process to the executed context, so if we define in bash i believe we can later access it in another js task from the process.env.

tunnckoCore avatar Jun 06 '18 19:06 tunnckoCore

My idea was to just append the global section to the other scripts according to language. That way, it can setup a global function as well that is used in the other scripts. Much easier to implement than passing total environments from one process to another.

raguay avatar Jun 07 '18 02:06 raguay

A shared global section that allows basic data types to be used in all language blocks would be very useful here.

(in addition to the original proposal for language-specific globals)


EG:

## global

```variables
destdir='~/.dest'
```

instead of

## global

```bash
destdir='~/.dest'
```

```js
 var destdir='~/.dest'
```

Enteleform avatar Jul 19 '18 17:07 Enteleform

Er, quick question, completely unrelated: @egoist , how did you create the code block image? I.e. this one?

shadowrylander avatar Sep 15 '18 06:09 shadowrylander

@ShadowRylander https://github.com/dawnlabs/carbon I bet.

millette avatar Sep 15 '18 07:09 millette

Ah, yes; thanks for that! Much appreciated!

shadowrylander avatar Sep 15 '18 20:09 shadowrylander