Show Menu
Cheatography

Glue Cheat Sheet by

Cheat Sheet for the glue scripting language (https://github.com/nablex/glue)

Command Line Execution

glue.bat / glue.sh [param­eters] script.glue

parame­ters:
- path=string­;st­rin­g;...
- debug=boolean
- trace=boolean
- markdown=boolean

Data Types

integer
-256
decimal
-256.15
string
"­str­ing­", 'string'
boolean
true, false
arrays
[value, ...]
tuple
(value, ...) ¹
map
map(key1, key2,
 ­ ­tuple(value1, value2),
 ­ ­tuple(value1, value2)
resource
string('filename')
¹ immutable array
² access tuple in map can be done like this:
for (record : map)
 ­ ­echo(record/key1)

Statements

If Statement
if (expression)

 ­ ­sta­tements


Switch Statement
switch (expression)

 ­ case value

 ­ ­ ­ ­sta­tements

 ­ case value

 ­ ­ ­ ­sta­tements


For Loop
for (list)

 ­ ­sta­tem­ent­s($­value)


for (val : list)

 ­ ­sta­tem­ent­s(val)


for (10)

 ­ ­sta­tem­ent­s($­index)
 

Test Methods

confirm/validateNull(message, result)
confir­m/v­alidate the result is null¹
confirm/validateTrue(message, result)
confir­m/v­alidate result equals 'true'¹
confirm/validateMatches(message, regex, actual)
confir­m/v­alidate the actual value matches the given regex¹
confirm/validateContains(message, regex, actual)
confir­m/v­alidate the actual value contains the given regex¹
confirm/validateEquals(message, expected, actual)
confir­m/v­alidate the actual value is equal to the expected value¹
not(boolean)
inverse the value of the boolean
¹ confirm methods stops the script when result is false
validate methods continue the script when result is false

Script Methods

echo(messages)
show the messages in the terminal
debug(messages)
show the messages when in debug mode
 

String Methods

padRight(pad, len, strings)
add character to end of string until len is reached
padLeft(pad, len, strings)
add character to beginning of string until len is reached
pad(pad, len, location, strings)
add character to location of string until len is reached
upper(strings)
uppercases the strings
lower(strings)
lowercases the strings
substring(string, start, stop)
retrieves a substring of the given string
replace(regex, replac­ement, strings)
replaces regex with replac­ement in the given strings
find(regex, strings)
find the regex in the given strings
lines(strings)
return the number of lines in strings
columns(strings)
return the number of columns in strings, splitted by '\t' and ';'
trim(strings)
removes leading and trailing spaces
join(separator, strings)
combines given strings adding the separator in between
split(regex, strings)
splits the given strings using the regex
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.