PowerShell module StrInt
is a demo module created to showcase how to create PS cmdlets (pronounced command-lets) in C# language.
This module is created just for learning purposes, but it's sub goal is to enable mathematical operations over integers represented by strings.
It has following three cmdlets:
Get-StrIntSum
- returns sum of given numbersGet-StrIntProduct
- returns product (multiplication) of given numbersGet-StrIntFibonacci
- returns n-th Fibonacci number
git clone https://github.com/iricigor/StrInt
cd StrInt
dotnet build
Import-Module ./bin/Debug/netstandard2.0/StrInt.dll -Force
š§ Fun fact: All programming logic in this module (helper.cs, Pester tests) is created by ChatGPT! Read more about it here or try it yourself!
Run dotnet
commands:
$name = 'StrInt'
mkdir $name && cd $name
dotnet new -i Microsoft.PowerShell.Standard.Module.Template
dotnet new psmodule
dotnet new gitignore
dotnet build
Then, verify it in PowerShell:
Import-Module ".\bin\Debug\netstandard2.0\$name.dll"
Get-Module $name
Test-SampleCmdlet 12
It should generate output similar to this:
FavoriteNumber FavoritePet
-------------- -----------
12 Dog