Functions/Sesio.ps1

# Import individual function files and utilities
. $PSScriptRoot\Util.ps1
. $PSScriptRoot\Ses\Sesio-Init.ps1
. $PSScriptRoot\Ses\Sesio-Arc.ps1
. $PSScriptRoot\Ses\Sesio-Config.ps1
. $PSScriptRoot\Ses\Sesio-Run.ps1

$resetColor = "$([char]0x1b)[0m"

# Main function to handle command-line arguments
function Sesio {
    param (
        [Parameter(Position=0, Mandatory=$true)]
        [string]$Command,
        
        [Parameter(ValueFromRemainingArguments=$true)]
        $RemainingArgs
    )

    switch ($Command.ToLower()) {
        "init" { Sesio-Init @RemainingArgs }
        "config" { Sesio-Config @RemainingArgs }
        "arc" { Sesio-Arc @RemainingArgs }
        "help" { Help }
        "run" { Sesio-Run @RemainingArgs }
        default { Write-Error "Unknown command: $Command" }
    }
}

function Help {
    Write-Host "$infoColor Sesio Help $resetColor"
    Write-Host ""
    Write-Host "$infoColor Usage: Sesio <command> [options]$resetColor"
    Write-Host ""
    Write-Host "$infoColor Commands:$resetColor"
    Write-Host "$([char]0x1b)[32m--------------------------------$([char]0x1b)[0m"
    Write-Host "$([char]0x1b)[31minit$([char]0x1b)[0m - Initialize a Sesio project"
    Write-Host " Options:"
    Write-Host " -env Environment name"
    Write-Host " -config Configuration file"
    Write-Host ""
    Write-Host "$([char]0x1b)[31mconfig$([char]0x1b)[0m - Configure Sesio"
    Write-Host " Commands:"
    Write-Host " add Add new configuration"
    Write-Host " azure Configure Azure settings"
    Write-Host " list List all configurations"
    Write-Host " env Manage environment variables"
    Write-Host ""
    Write-Host "$([char]0x1b)[31marc$([char]0x1b)[0m - Arc operations"
    Write-Host " Commands:"
    Write-Host " create Create new arc file"
    Write-Host " update Update existing arc file"
    Write-Host " list List all arc files"
    Write-Host " run Run a session"
    Write-Host ""
    Write-Host "$([char]0x1b)[31mrun$([char]0x1b)[0m - Run operations"
    Write-Host " Commands:"
    Write-Host " "
    Write-Host " status Check status of a running session"
    Write-Host " -instanceId The ID of the running instance"
    Write-Host " <path> Run a session from specified path (optional)"
    Write-Host " If no path is provided, it will run in the default folder"
    Write-Host ""
    Write-Host "$([char]0x1b)[31mhelp$([char]0x1b)[0m - Show command help"
    Write-Host " Usage: sesio <command> help"
    Write-Host "$([char]0x1b)[32m--------------------------------$([char]0x1b)[0m"
    Write-Host ""
    Write-Host "Examples:"
    Write-Host " sesio run -env dev -config myconfig"
    Write-Host " sesio config env set KEY VALUE"
    Write-Host " sesio arc create -file config -env dev"
    Write-Host " sesio config azure"
    Write-Host " sesio run"
}

# Export the main function
Export-ModuleMember -Function Sesio