provisioning-outreach/presentations/pres-prvng/no/run-simple.nu

93 lines
3.4 KiB
Text
Executable file

#!/usr/bin/env nu
# Provisioning Platform - Presentation Launcher (Simplified Version)
# More compatible with different Nushell versions
#
# Usage:
# nu run-simple.nu # Show menu and choose
# nu run-simple.nu pitch # Launch pitch.md
# nu run-simple.nu talk.md # Launch talk.md
def main [presentation?: string] {
# Define available presentations
let presentations = [
{ idx: 1, name: "pitch.md", audience: "Executives", duration: "10 min", slides: 12 }
{ idx: 2, name: "demo-intro.md", audience: "Developers", duration: "15 min", slides: 10 }
{ idx: 3, name: "talk.md", audience: "Technical", duration: "30-45 min", slides: 25 }
{ idx: 4, name: "workshop.md", audience: "Learners", duration: "1-2 hours", slides: 40 }
{ idx: 5, name: "slides.md", audience: "All", duration: "Custom", slides: 40 }
]
# Filter only existing files
let available = $presentations | where { |p|
($p.name | path exists)
}
if ($available | length) == 0 {
print "❌ No presentation files found!"
return
}
# Determine which presentation to launch
let selected = if ($presentation == null) {
# Show menu
print "\n╔═══════════════════════════════════════════════════════════════╗"
print "║ Provisioning Platform - Presentation Launcher ║"
print "╚═══════════════════════════════════════════════════════════════╝\n"
$available | each { |p|
let name_pad = ($p.name | fill --alignment left --width 15)
let audience_pad = ($p.audience | fill --alignment left --width 12)
print $" [($p.idx)] $name_pad │ $audience_pad │ ($p.duration)"
}
print "\n [Q] Quit\n"
let choice = (input "Select presentation (1-5): ")
match $choice {
"q" | "Q" => {
print "👋 Goodbye!"
return
}
"1" => { $available | where { |p| $p.idx == 1 } | get 0 }
"2" => { $available | where { |p| $p.idx == 2 } | get 0 }
"3" => { $available | where { |p| $p.idx == 3 } | get 0 }
"4" => { $available | where { |p| $p.idx == 4 } | get 0 }
"5" => { $available | where { |p| $p.idx == 5 } | get 0 }
_ => {
print "❌ Invalid selection"
return
}
}
} else {
# Validate argument
let with_ext = if ($presentation | str ends-with ".md") {
$presentation
} else {
$"($presentation).md"
}
let found = $available | where { |p| $p.name == $with_ext }
if ($found | length) == 0 {
print $"❌ Presentation not found: $with_ext"
print "\nAvailable:"
$available | each { |p| print $" • ($p.name)" }
return
}
$found | get 0
}
# Launch
print ""
print $"🚀 Launching: ($selected.name)"
print " 📺 View at: http://localhost:3030"
print " ⌨️ Press 'S' for speaker notes, 'F' for fullscreen"
print ""
pnpm run dev $selected.name
}
main ...$nu.env.ARGS.positional