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

Global Variables #11

Open
raguay opened this issue Jun 1, 2018 · 8 comments
Open

Global Variables #11

raguay opened this issue Jun 1, 2018 · 8 comments

Comments

@raguay
Copy link

raguay commented Jun 1, 2018

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.

@saadq
Copy link

saadq commented Jun 1, 2018

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'
```

@egoist
Copy link
Owner

egoist commented Jun 1, 2018

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

carbon 45

@tunnckoCore
Copy link
Contributor

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.

@raguay
Copy link
Author

raguay commented Jun 7, 2018

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.

@Enteleform
Copy link

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'
```

@shadowrylander
Copy link

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

@millette
Copy link

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

@shadowrylander
Copy link

Ah, yes; thanks for that! Much appreciated!

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

No branches or pull requests

7 participants