Tutorial Design #4
jdhitsolutions
started this conversation in
General
Replies: 2 comments 6 replies
-
|
The tutorial feature captures the user's actual prompt. $prompt = ((&prompt | Out-String) -replace "`n|`r", '').Trim()In the tutorial, a prompt is presented that looks like the user. $P5 = @"
Notice the Verb-Noun naming convention. The source is the name of the PowerShell {0}module{1} that
contains the command. A module is a package of related commands. Many modules are shipped with
PowerShell. Eventually, you will learn how to install additional modules from the PowerShell Gallery.
The {0}Version{1} number is the module version number.
Once you narrow down the command you want, use {2}Get-Command{1} to show you the syntax or how
to run the command.
$prompt {2}Get-Command{1} {3}Get-Process{1} {4}-syntax{1}
"@ -f $highLight,$reset,$cmdStyle,$defaultTokenStyle,$paramStyle |
Beta Was this translation helpful? Give feedback.
5 replies
-
|
Tutorials also use a custom pause function. function pause {
[void](Read-Host "`e[3;37mEnter to continue$($PSStyle.Reset)")
"`e[2A"
"`e[K"
"`e[3A"
"`e[1G"
}The tutorial presents information in bite-size chunks and pauses. The pause function will wait until the user presses Enter, but then it uses ANSI magic to remove the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment





Uh oh!
There was an error while loading. Please reload this page.
-
In the initial module design, tutorials are written as stand-alone script files. The module provides a function to launch the tutorial. Each tutorial is a combination of text, often formatted with PSStyle, live output from the user's console, Clear-Host commands, and pauses. I thought I might move the static content to JSON files that could be imported. However, that makes adding formatting more difficult unless the text is exported to JSON with the styling. But then there's the challenge of orchestrating the content with live output and pauses.
I think editing or updating the content in JSON would be tedious. Otherwise we would need an authoring tool. I think the stand-alone script is easy to maintain. The user never sees the code and I can't think of any performance benefit to moving the data to external files.
Beta Was this translation helpful? Give feedback.
All reactions