Skip to content

Instantly share code, notes, and snippets.

@niieani
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niieani/f2d2793a00f11b7295e8 to your computer and use it in GitHub Desktop.
Save niieani/f2d2793a00f11b7295e8 to your computer and use it in GitHub Desktop.
Example usage of Bash Infinity Framework ( http://invent.life/project/bash-infinity-framework )
# See info @ http://invent.life/project/bash-infinity-framework
Human Bazyli
Bazyli.height = 100
# calls a function with a parameter
Bazyli.Eat strawberries
Bazyli.Eat lemon
# calls tostring method
Bazyli
# empty, not set yet
Bazyli.name
# set value
Bazyli.name = "Bazyli Brzóska"
if Bazyli == Bazyli
then
echo equals operator passed
fi
# call setter on height
Bazyli.height = 170
# if you want to use a parametrized constructor,
# create an object and use the double tilda ~~ operator, like this:
Human Mambo ~~ Mambo Jumbo 150 960
echo $(Bazyli.name) is $(Bazyli.height) cm tall.
# throws an error - object is immutable
Bazyli = "house"
# initialize two arrays
Array Letters
Array Letters2
Letters.Add "Hello Bobby"
Letters.Add "Hello Jean" "Hello Maria"
Letters2.Add "Hello Frank" "Bomba"
Letters2.Add "Dude, How are you doing?"
letters2=$(Letters2)
Letters.Merge "${!letters2}"
Letters.List
Letters.Contains "Hello" && echo "This shouldn't happen"
Letters.Contains "Hello Bobby" && echo "Bobby was welcomed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment