Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kzrnm committed Aug 5, 2024
1 parent 9605dd4 commit ce56789
Show file tree
Hide file tree
Showing 6 changed files with 260 additions and 74 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [2.0.0] - 2024-08-05
### Added
- Show-KurukuruSample
- `Show-KurukuruSample`
- `New-KurukuruPattern`
- `New-Spinner`
- Run `Start-Kurukuru` with spinner

## [1.1.2] - 2022-01-15
### Changed
Expand Down
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,71 @@ Start-Kurukuru -Pattern ([Kurukuru.Pattern]::new(@("_", " ̄"), 150)) {
}).GetNewClosure()
} | Start-Kurukuru
```

### Start-Sleep

```powershell
function Start-KurukuruSleep {
[CmdletBinding(DefaultParameterSetName = 'Seconds')]
param (
[Parameter(ParameterSetName = 'FromTimeSpan', Mandatory, Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName)]
[Alias('ts')]
[timespan]
$Duration,
[Parameter(ParameterSetName = 'Milliseconds', Mandatory, ValueFromPipelineByPropertyName)]
[Alias('ms')]
[int]
$Milliseconds,
[Parameter(ParameterSetName = 'Seconds', Mandatory, Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName)]
[double]
$Seconds,
$Pattern = $null
)
switch ($PSCmdlet.ParameterSetName) {
'Milliseconds' {
$Duration = [timespan]::FromMilliseconds($Milliseconds)
}
'Seconds' {
$Duration = [timespan]::FromSeconds($Seconds)
}
}
$until = [datetime]::Now.Add($Duration)
$untilText = "Waiting until $($until.ToString())..."
Start-Kurukuru -Pattern $Pattern -Text $untilText -SucceedText 'Finish.' {
param($s)
try {
do {
$remaining = $until - (Get-Date)
$s.Text = "$untilText Ramaining $remaining"
Start-Sleep -Milliseconds 300
}while ($remaining -gt 0)
}
catch {
}
}
}
Register-ArgumentCompleter -CommandName New-Spinner, Start-Kurukuru -ParameterName Color -ScriptBlock {
param(
$commandName,
$parameterName,
$wordToComplete,
$commandAst,
$fakeBoundParameter
)
$Names = $KurukuruPatterns.Name
if ($wordToComplete.Length -eq 0) { return $Names }
foreach ($item in $Names) {
if ($item.ToLower().StartsWith($wordToComplete.ToLower())) {
[System.Management.Automation.CompletionResult]::new(
$item,
$item,
[System.Management.Automation.CompletionResultType]::ParameterValue,
$item)
}
}
}
```
11 changes: 7 additions & 4 deletions kurukuru-pwsh.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RootModule = 'kurukuru-pwsh.psm1'

# Version number of this module.
ModuleVersion = '1.1.2'
ModuleVersion = '2.0.0'

# ID used to uniquely identify this module
GUID = '3efd22ec-7409-4f93-9d2b-8b78416e63fe'
Expand All @@ -25,15 +25,18 @@
FunctionsToExport = @(
'Start-Kurukuru',
'Show-KurukuruSample',
'New-Spinner',
'Get-KurukuruPattern'
'Get-KurukuruPattern',
'New-KurukuruPattern',
'New-Spinner'
)

# Cmdlets to export from this module
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = @()
VariablesToExport = @(
'KurukuruPatterns'
)

# Aliases to export from this module
AliasesToExport = @()
Expand Down
Loading

0 comments on commit ce56789

Please sign in to comment.