Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A PowerShell module for creating resumable, step-by-step automation scripts with automatic state persistence and cross-platform support.

License

Notifications You must be signed in to change notification settings

jakehildreth/Stepper

Repository files navigation

Stepper

A PowerShell utility module for creating resumable scripts with automatic state persistence.

Demo

Test.ps1.mp4

How It Works

  • Each step is tracked by its location in the script (file:line)
  • State is saved after each successful step in a .stepper file (includes ScriptContents, LastCompletedStep, timestamp, and persisted $Stepper data)
  • On resume, completed steps can be skipped automatically
  • If the script has changed between runs, Stepper prompts the user to Resume, Start over (removes the state file), view More details, or Quit
  • Non-resumable code is detected and can be suppressed with #region Stepper ignore/#endregion Stepper ignore or handled interactively
  • Use the More details view to inspect saved step body, Stepper variables, and restart context
  • Call Stop-Stepper at the end to clean up

Installation

Install-Module -Name Stepper

Usage

Wrap your script steps in New-Step blocks. If the script fails inside of a New-Step block, the next run of the script resumes at the step that failed.

#Requires -Modules Stepper
[CmdletBinding()]
param()

New-Step {
    Write-Host "Step 1: Download files..."
    # Your code here
}

New-Step {
    Write-Host "Step 2: Process data..."
    # Your code here
}

New-Step {
    Write-Host "Step 3: Upload results..."
    # Your code here
}

Stop-Stepper

Data Persistence

Use the $Stepper variable to share data between steps:

New-Step {
    $Stepper.Data = Get-Process
}

New-Step {
    $Stepper.Data | Where-Object CPU -gt 100
}

License

MIT with Commons Clause - see LICENSE

About

A PowerShell module for creating resumable, step-by-step automation scripts with automatic state persistence and cross-platform support.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

No packages published

Contributors 3

  •  
  •  
  •