About Monad
I got to play with Monad today, so here are a few quick impressions:
- No environment variables, I tried to do a cd %windir% and it didn't expand it.
- Auto completion for file names gives the full path, unlike cmd, which gives relative path, this is very annoying, actually.
- You get auto completion for cmdlets (Cool), but not for .Net's namespaces (Not Cool).
- Trying to run a script normally doesn't work: regex.msh fails, while .\regex.msh succeeds, I've no idea why, they are functionaly identical.
- It's fun to work with.
Here is a small script that handles extracting regex expression from files:
{
"Arguments are: <file> <regex-pattern>"
break
}
$file = [string]$args[0]
$pattern = [string]$args[1]
$re = new-object System.Text.RegularExpressions.Regex($pattern)
foreach ($line in $(Get-Content $file))
{
$match = $re.Match($line);
if($match.Success)
{
$match.Value
}
}
Here is how you would get all the ifs in a script:
$args.Count -lt 2
$match.Success
Comments
Comment preview