123 lines
4.3 KiB
Text
123 lines
4.3 KiB
Text
#!/usr/bin/env nu
|
|
|
|
# Provisioning Platform - Presentation Launcher
|
|
#
|
|
# Usage:
|
|
# nu run.nu # Show options and choose
|
|
# nu run.nu pitch # Launch pitch.md
|
|
# nu run.nu talk.md # Launch talk.md
|
|
# nu run.nu demo-intro # Launch demo-intro.md
|
|
#
|
|
# Features:
|
|
# - Auto-adds .md extension if needed
|
|
# - Validates file exists
|
|
# - Provides interactive selection menu
|
|
# - Shows helpful information about each presentation
|
|
|
|
def get-available-presentations [] {
|
|
let presentations = [
|
|
{ name: "pitch.md", audience: "Executives", duration: "10 min", slides: 12, description: "Quick ROI-focused pitch" }
|
|
{ name: "demo-intro.md", audience: "Developers", duration: "15 min", slides: 10, description: "Context before live demo" }
|
|
{ name: "talk.md", audience: "Technical", duration: "30-45 min", slides: 25, description: "Deep technical dive" }
|
|
{ name: "workshop.md", audience: "Learners", duration: "1-2 hours", slides: 40, description: "Comprehensive training" }
|
|
{ name: "slides.md", audience: "All", duration: "Custom", slides: 40, description: "Master file with all content" }
|
|
]
|
|
|
|
$presentations
|
|
| where { |p| ($p.name | path exists) }
|
|
}
|
|
|
|
def format-presentations [presentations: list] {
|
|
print "\n╔════════════════════════════════════════════════════════════════╗"
|
|
print "║ Infrastructure Provisioning Platform - Slides ║"
|
|
print "╚════════════════════════════════════════════════════════════════╝\n"
|
|
|
|
$presentations
|
|
| enumerate
|
|
| each { |item|
|
|
let idx = $item.index + 1
|
|
let p = $item.item
|
|
let slides = $p.slides
|
|
|
|
print $" [$idx] ($p.name | str pad -l 15) │ ($p.audience | str pad -l 12) │ ($p.duration)"
|
|
print $" └─ ($p.description) ($slides slides)"
|
|
print ""
|
|
}
|
|
}
|
|
|
|
def select-presentation [presentations: list] {
|
|
let choice = (
|
|
input "Select presentation number (or press Ctrl+C to cancel): "
|
|
)
|
|
|
|
try {
|
|
let idx = ($choice | into int) - 1
|
|
|
|
if $idx < 0 or $idx >= ($presentations | length) {
|
|
print $"❌ Invalid selection: $choice"
|
|
error "Please select a valid number"
|
|
}
|
|
|
|
$presentations | get $idx
|
|
} catch {
|
|
print "❌ Invalid input. Please enter a number."
|
|
error "Invalid selection"
|
|
}
|
|
}
|
|
|
|
def launch-presentation [file: string] {
|
|
print ""
|
|
print $"🚀 Launching presentation: ($file)"
|
|
print " 📺 View at: http://localhost:3030"
|
|
print " ⌨️ Controls: Arrow keys to navigate, S for speaker view, F for fullscreen, ESC for overview"
|
|
print ""
|
|
|
|
pnpm run dev $file
|
|
}
|
|
|
|
def main [presentation?: string] {
|
|
# Get available presentations
|
|
let available = (get-available-presentations)
|
|
|
|
if ($available | length) == 0 {
|
|
print "❌ No presentation files found!"
|
|
print " Please run this script from the pres-prvng directory"
|
|
return
|
|
}
|
|
|
|
# Determine which presentation to launch
|
|
let selected = if ($presentation == null) {
|
|
# No argument provided - show menu
|
|
format-presentations $available
|
|
select-presentation $available
|
|
} else {
|
|
# Argument provided - validate and find it
|
|
let with_extension = (
|
|
if ($presentation | str ends-with ".md") {
|
|
$presentation
|
|
} else {
|
|
$"($presentation).md"
|
|
}
|
|
)
|
|
|
|
let found = $available | where { |p| $p.name == $with_extension }
|
|
|
|
if ($found | length) == 0 {
|
|
print $"❌ Presentation not found: $with_extension"
|
|
print ""
|
|
print "📋 Available presentations:"
|
|
format-presentations $available
|
|
print ""
|
|
let selected_item = (select-presentation $available)
|
|
$selected_item
|
|
} else {
|
|
$found | get 0
|
|
}
|
|
}
|
|
|
|
# Launch the selected presentation
|
|
launch-presentation $selected.name
|
|
}
|
|
|
|
# Run the main function with arguments
|
|
main ...$nu.env.ARGS.positional
|