kapitancho / walnut-lang-cli-adapter
There is no license information available for the latest version (0.0.6) of this package.
0.0.6
2024-04-09 22:02 UTC
Requires
- php: >=8.2
- kapitancho/walnut-lang: ^0.0.8
README
A small adapter for performing CLI calls to Walnut language code.
Installation
To install the latest version, use the following command:
$ composer require kapitancho/walnut-lang-cli-adapter
Usage
module demo-cli:
calc = ^Array<String> => Result<Integer, Any> ::
?noError(?noError(#->item(0))->asInteger) +
?noError(?noError(#->item(1))->asInteger);
main = ^Array<String> => String :: {
s = calc(#);
?whenTypeOf(s) is {
type{Integer}: s->asString,
~: 'Invalid parameters'
}
};
php -f cli.php demo-cli 1 2
# Output: 3
php -f cli.php demo-cli 3 cats
# Output: Invalid parameters
Examples
You can browse the examples repository.