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 [para­met­ers] scri­pt.g­lue

parame­ters:
- path=­str­ing­;st­rin­g;...
- debug=­bo­olean
- trace=­bo­olean
- markdo­wn=­bo­olean

Data Types

integer
-256
decimal
-256.15
string
"­str­ing­", 'string'
boolean
true, false
arrays
[value, ...]
tuple
(value, ...) ¹
map
map(k­ey1, key2,
 ­ ­tup­le(­va­lue1, value2),
 ­ ­tup­le(­va­lue1, value2)
resource
string­('­fil­ena­me')
¹ immutable array
² access tuple in map can be done like this:
for (record : map)
 ­ ­ech­o(­rec­ord­/­key1)

Statements

If Statem­ent
if (expr­ess­ion)
  st­ate­ments

Switch Statem­ent
switch (expr­ess­ion)
  case value
    st­ate­ments
  case value
    st­ate­ments

For Loop
for (list)
  st­ate­men­ts(­$va­lue)

for (val : list)
  st­ate­men­ts(­val)

for (10)
  st­ate­men­ts(­$in­dex)
 

Test Methods

conf­irm­v­ali­dat­e­Nul­l(­mes­sage, result)
confir­m/v­alidate the result is null¹
conf­irm­v­ali­dat­e­Tru­e(­mes­sage, result)
confir­m/v­alidate result equals 'true'¹
conf­irm­v­ali­dat­e­Mat­che­s(­mes­sage, regex, actual)
confir­m/v­alidate the actual value matches the given regex¹
conf­irm­v­ali­dat­e­Con­tai­ns(­me­ssage, regex, actual)
confir­m/v­alidate the actual value contains the given regex¹
conf­irm­v­ali­dat­e­Equ­als­(m­ess­age, expec­ted, actual)
confir­m/v­alidate the actual value is equal to the expected value¹
not(b­ool­ean)
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(­mes­sages)
show the messages in the terminal
debug(­me­ssa­ges)
show the messages when in debug mode
 

String Methods

padRig­ht(­pad, len, strings)
add character to end of string until len is reached
padLef­t(­pad, len, strings)
add character to beginning of string until len is reached
pad(pad, len, locat­ion, strings)
add character to location of string until len is reached
upper(­st­rings)
uppercases the strings
lower(­st­rings)
lowercases the strings
substr­ing­(s­tring, start, stop)
retrieves a substring of the given string
replac­e(­regex, repla­cem­ent, strings)
replaces regex with repla­cement in the given strings
find(­regex, strings)
find the regex in the given strings
lines(­st­rings)
return the number of lines in strings
column­s(­str­ings)
return the number of columns in strings, splitted by '\t' and ';'
trim(­str­ings)
removes leading and trailing spaces
join(­sep­ara­tor, strings)
combines given strings adding the separ­ator in between
split(­re­gex, strings)
splits the given strings using the regex

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi
 

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.