PBS_2025_01_18

An audio podcast where Bart Busschots is teaching the audience to program. Associated tutorial shownotes are available at https://pbs.bartificer.net.

2025, Allison Sheridan
Chit Chat Across the Pond

Automatic Shownotes

Chapters

0:14 
Introduction to Programming by Stealth
2:05 
Transitioning from Bash to PowerShell
2:30 
Understanding PowerShell Parameters
8:27 
Parameter Definitions and Types
11:03 
Default Parameter Values
13:16 
Implementing Default Values in Functions
14:31 
Exploring Parameter Options
15:59 
Introducing Common Parameters
38:31 
Leveraging Common Parameters in Functions
54:31 
Utilizing Help Documentation in PowerShell
1:03:24 
Navigating PowerShell Documentation
1:07:20 
Upcoming Topics for 2025
1:11:41 
Introduction to GitHub Pages
1:12:58 
Customizing Bootstrap with Sass
1:14:47 
Learning PowerShell from the Ground Up
1:16:07 
Closing Remarks and Support Information

Long Summary

This episode of Programming by Stealth presents Tidbit 11, recorded on January 18, 2025. I delve into PowerShell, particularly my transition from Bash scripting to PowerShell scripting. I've discovered that PowerShell, while being a Microsoft product, stands out with its open-source, cross-platform capabilities. My co-host Bart and I discuss installing PowerShell via Homebrew and the advantages of using Visual Studio Code as an IDE for scripting.

As we explore PowerShell, I emphasize how everything operates as functions, including commands typed in the shell. This leads to a discussion about PowerShell's unique piping system, which allows data to flow differently than in Bash, utilizing multiple outputs for different types of information, such as errors and warnings. I touch on how PowerShell has addressed the limitations of Bash with its more structured handling of parameters and arguments.

A significant focus is placed on parameters, where I explain the difference between named and positional parameters. PowerShell allows for explicitly defining parameter names, enhancing script clarity and enabling robust argument handling. We cover how parameters are categorized and the importance of defining their types, which not only helps with clarity but also assists PowerShell in performing type coercion and validation.

I explain how default values can be set for parameters, demonstrating this with examples, and we discuss various options available for defining parameters, like making them mandatory, which ensures users provide required arguments. I also highlight how PowerShell can facilitate smoother user experience, such as prompting for parameters when they are not provided.

As we progress, I delve into common parameters, which establish a uniform standard across PowerShell commands, allowing my custom functions to mirror the behavior of built-in commands. The introduction of cmdlet binding provides advanced functionality like verbose output and the ‘WhatIf’ feature, which serves as a safety mechanism during script execution.

I emphasize the readability and organization of scripts, showcasing how to enhance documentation through comments that assist with automatic help documentation for custom functions. This leads to exploring how external resources, such as the PowerShell Gallery, enable users to expand their scripting capabilities by integrating community modules.

In wrapping up, I lay out my plans for the future, including an exciting transition to GitHub Pages for our series in 2025, which will introduce listeners to web hosting techniques using markdown and Bootstrap. I emphasize the importance of consistency in coding practices within PowerShell, and how understanding these principles cultivates effective and maintainable scripts.

The episode concludes with a look at the upcoming learning pathways for PowerShell and a commitment to integrate practical applications alongside theoretical principles, ensuring listeners can easily navigate and leverage the power of PowerShell in their own workflows.

Brief Summary

In this episode of Programming by Stealth, I discuss my transition from Bash to PowerShell scripting, highlighting its open-source, cross-platform nature and installation via Homebrew. Together with co-host Bart, we explore using Visual Studio Code and delve into PowerShell's function-based operation, parameter handling, and cmdlet binding for enhanced script functionality. I also cover documentation best practices and resources from the PowerShell Gallery. I wrap up with plans for our transition to GitHub Pages and emphasize the importance of consistent coding practices for effective scripting.

Tags

Programming by Stealth
Bash
PowerShell
scripting
open-source
cross-platform
Homebrew
Visual Studio Code
cmdlet binding
GitHub Pages

Transcript

[0:00]Music
[0:07]Well, it's that time of the week again. It's time for Programming by Stealth,
[0:14]
Introduction to Programming by Stealth
[0:10]and this is Tidbit 11, recorded January 18th, 2025. And I'm your host, Alison Sheridan, and of course, I'm joined by your co-host, Bart Bouchotts. How are you doing today, Bart?
[0:21]Bonjour. That's all my French. Sorry.
[0:26]Oh, dear. Well, so we're continuing Tidbit 11.
[0:31]Yes, which was two weeks ago, I think. Yeah, we didn't skip a week. Yeah. So I teased everyone by saying, so after we learned Bash, I didn't really use Bash anymore. And I started using PowerShell. And it turns out that it's actually really good. It may be by Microsoft, but it's open source, it's cross-platform. We can install it from Homebrew. And then we talked a little bit about getting our tooling set up. So getting Homebrew installed, sorry, getting PowerShell installed via Homebrew. And then when you're ready to take it to the next level you can use vs code the open source ide from microsoft which also rocks um now we talked a little bit about the fact that it's functions all the way down so in powershell universe a script is just a function in a file by itself so everything you learn about functions it's true of scripts and in fact the powershell commands you type with the command line are also just functions in disguise so everything's functions all the way down. We talked about how the plumbing was completely reinvented. So there's a special pipe for data. And then we get four pipes for output to humans, which are effectively outputs of the terminal for information, outputs of the terminal for errors, for warnings, and for debugging, which is the fourth stream. And I think that they're sort of the main headings, right?
[2:01]Yeah, I think so.
[2:03]Then we hit our break point.
[2:05]
Transitioning from Bash to PowerShell
[2:06]Right. So we took a break because it was getting a little, it was getting too long for me to pay attention that long and maybe for everybody else.
[2:15]Yeah. And then because we split it up, I then didn't stop writing show notes. So if anyone listens to this and goes, oh my God, Bart thought this was one episode. What you're going to get today is a little more padded out than you would have got if we'd done it all at once. But it was still too long. So we still had to break it up.
[2:30]
Understanding PowerShell Parameters
[2:31]So the next big difference the thing that the power shell had the benefit of learning from right because they're not better than the people wrote bash they just had 30 years more experience of how people script and what doesn't work you know so when you reinvent the wheel 30 years later you can do better you know like carbon fiber and cool stuff so the next thing they did better is how parameter basically arguments what we would think of as arguments but in uh you know parameter is this just another word for argument and in the power shell documentation they chose parameters so i guess we should get into that habit here but they added a big level of explicitness to how arguments work to your scripts. So in Bash, it's kind of the Wild West. So Bash just says, the first thing you give me is the command, and then everything after that is split on space, and they're just your arguments. And if you want to assign meaning to them, that's your problem.
[3:39]And there are tools to help add conventions, like we learned about GetOpt. So with GetOpt, you can say minus, and then a single letter and then maybe space and a value. But what's happening under the hood there is that GetApt is breaking the long list of arguments apart and picking out the named ones.
[3:59]Isn't it GetApt?
[4:02]Well, they both exist. We looked at one of them and the other one also exists, but it's a little bit different. Just to prove my point.
[4:10]Okay, great.
[4:12]And there's also an even more complicated one that gives you the minus minus followed by a big long name. It's also a completely different C library that you can use in your bash commands for a whole different way of doing arguments. So it's kind of the Wild West. whereas PowerShell were like no no we're going to build this into our scripting language we're going to give you a mechanism for pre-defining your arguments which gives us a few interesting superpowers that we'll get to so its view of arguments or parameters as we've got it used to calling them, is that they come in two flavors. There are named arguments, which are a single minus and then a long descriptive name. So minus some name. You know, it's not just a single letter. And then there are arguments with no name, and they're called positional. So you have positional parameters and named parameters.
[5:15]So let me guess, positional parameters are based Based on its position, PowerShell knows what you're talking about.
[5:21]Yeah, they're numbered from zero. So positional parameter zero, positional parameter...
[5:27]Wait, so they're a number?
[5:29]That's how you describe their position, right? So the first one that isn't named is at position zero.
[5:35]Okay, got you, got you. Okay, but by its position, PowerShell understands what to do with it. It doesn't need a name in order...
[5:42]We have to tell it.
[5:43]Oh. Okay.
[5:44]No, no, but this is a good thing.
[5:45]I'll let you keep going then.
[5:46]Because, yeah. Okay, so positional parameters, when you're typing them with the command line, they don't have a name. And name parameters have a name. Very sensible. And the name parameters come in two flavors. They can be what PowerShell calls a switch, which is equivalent to a flag in Bash. So it's just minus something, no value. So minus verbose for enabling debug, say. It's just a single word. Or they can have a value, in which case it's basically minus name, space, and then the value. So you've named parameters with a value, and you've named switches. And so if you're looking at it on the command line, it's minus and then some name. And in your code, it becomes dollar some name.
[6:41]Right. I think we saw that last time, right?
[6:44]We did, because that's how we were doing with minus number became dollar number.
[6:50]Right. And if it's a switch... I'm just showing off that I remembered something. I appreciate you replicating it, but...
[6:56]You know, well, it's been two weeks. I have to scroll up to double check what we did. And then the switches, which I think of as flags still, because I've spent too long writing Bash, they just get the value true or false. So they will appear in your code as dollar whatever their name is with the true or false okay so you always have to define your parameters and we've seen a hint of this before right because when we were doing our scripts we were saying param and then what you know some stuff dollar number so the param is how you tell powershell this function or script expects a parameter and And then you tell it about that parameter. And the most important thing you have to tell it about the parameter is the name. So inside your code, they will always have a name, which kind of makes sense because there are going to be variables. But you have the power to hide the name from your users if you want to. So from the user's point of view, they can be positional. But they will always appear in your code with a name. So when you're coding, you can call them something sensible.
[8:13]I don't like that. I like it to have a name. It should have a name, but okay.
[8:18]You'll see this in action. It's quite useful. Okay. So you always have to give your parameter a name. So the simplest parameter
[8:27]
Parameter Definitions and Types
[8:24]definition is just dollar and then its name.
[8:28]Okay.
[8:29]And you can have multiple parameters by separating them with a comma all inside the call to param. And you can start to give more information about the parameters and that goes over multiple lines so the comma is important you say a bunch of stuff about first parameter comma a bunch of stuff about the second parameter and a bunch of stuff is allowed to be multiple lines depending on how descriptive you're going to be today so.
[8:58]They make it so you can format it to be readable and yet that last comma is what says, okay, now we're talking about a new parameter.
[9:06]Yes. And also the other thing to help your eye is that the last thing you do is give it its name. So you see blah, blah, blah, blah, blah, blah, blah, dollar something comma, blah, blah, blah, blah, blah, blah, dollar something comma. And so the dollar something is very helpful.
[9:21]Yeah.
[9:22]The documentation tells you, please give your parameters a type. Please help PowerShell know what is okay. Do I want a number? Do I want a string? What do I want here? And so you do that by putting the type you want in square brackets in front of the name. So if we wanted four parameters that were a string, a whole number, a decimal number, or one of these switches, you would say open square bracket string dollar my string parameter, comma open square bracket int close the square bracket dollar my integer parameter double or switch and that will become your boolean true false, So why do you want to bother? Apart from feeling good because you're doing what the documentation says, which is, hey, it's nice to do the right thing, right? But that's not a particularly good reason. The first thing you get for free is that, if possible, PowerShell will coerce the type. So if you tell it, I need an integer, and you type in 4.678, well, that'll just become 5. It'll just be coerced to an integer.
[10:36]Well, that one's a little dangerous. I was thinking you were saying, like, if I wrote F-O-R-T-Y-T-W-O or space T-W-O or something, it might go 42.
[10:47]It wouldn't do that one, but if you ended up giving it the string 42, you absolutely would get the number 42.
[10:55]Okay, yeah, I guess that makes more sense.
[10:56]And this becomes a little bit more powerful than you think, because if you give it a date in a nice, one of the...
[11:03]
Default Parameter Values
[11:04]Iso formats and it's quite permissive in the different formats it'll accept it will convert that to a date time oh where you can immediately start doing date and time math oh beautiful and it just knows oh this is a date so if you're saying add five weeks to this no problem i will give you a new date five weeks later so pretty powerful actually the type coercion the other thing you get is free validation. If it can't coerce the type, it will throw an error before even loading your function. So it's a very efficient way to just crash out. I don't even need to evaluate this code. This is going nowhere. This function needs a number and you gave me nothing. Good day, right? And this function can't run.
[11:51]Another thing you can do is control the default value of all of your parameters so the default default is null that's a weird sentence but it is correct so by default the default is null the default value is yeah okay yeah so if i say my function will have a parameter called waffles and you run my function and you don't give it any arguments waffles will be null so its default value is null but it doesn't have to be and the way you give it a default is wonderful you just say equals and the value you want in the param definition so type dollar name equals the default value uh.
[12:37]Bart you just invalidated what you said the last thing would be you said it would be dollar variable or parameter name comma
[12:44]Oh okay but sorry assigning the so you're giving the parameter a name is the last thing you do, right? So it's name and value. It's a variable definition, right? It's going to look like a variable definition.
[12:56]You're not just giving a name, you're giving it the value.
[13:01]The default file.
[13:02]Right.
[13:04]So I'm going to stop waving my hands for a little bit and do a little showing as well as telling. So we had a function two weeks ago called write hello world.
[13:16]
Implementing Default Values in Functions
[13:16]Let's give that function a parameter so it can say hello to anything. But by default, it'll greet the whole world. So we're going to say our function is now called write hello. So we're going to say function write hello open our curly param open the round bracket for param we want a string so square bracket string we're going to give it the name dollar target so the target of our greeting right i struggled a bit for a good name but dollar target is best i could do equals the string world write host in double quotation marks hello dollar target exclamation point. And so if we call that function with no arguments, sorry, no parameters, write hello, it just prints, hello world. But if I call it and say, write hello minus target waffles, it will print hello waffles.
[14:10]Oh, there we go. Okay.
[14:13]So I mentioned that it can spread over multiple lines.
[14:16]Even if you told it there should be a target, not giving it a target doesn't make it barf.
[14:23]Oh, because you gave it a default.
[14:25]Value for target. Gotcha. Correct. I just caught up.
[14:31]
Exploring Parameter Options
[14:31]So the other thing you can do is you can start giving your parameters what are called options. And you define these options by sticking a square bracket with the word parameter as a full word. And that's another function call. and you use that to give options to your parameter. And there are loads and loads and loads of possible options, but I just want to mention three.
[15:00]Before you do it, this syntax is going to make my head hurt. So we just said that to define a parameter, it's param space open close round brackets with the name of the parameter and telling it it's a string or giving it a default value. So param space open close parentheses now we've got square bracket parameter open close round close square bracket and this means something completely different
[15:30]We are giving, we're describing our parameter. So it's going to go above one of these lines that gives our parameter a name. And what it's saying is, for the parameter being defined here, these are extra options. So this is like, I'm giving you more information about dollar number or dollar target. So you're being more specific about what you want.
[15:56]So you say it before.
[15:59]
Introducing Common Parameters
[16:00]So the last thing is always the name right so if i had five parameters i could have five calls to the function parameter so set some options give it a name comma set some options give it a name comma set some options give it a name and then finish okay.
[16:22]I don't like this syntax but go ahead
[16:26]The syntax is a little weird you do get used to it very quickly because it it does end up looking natural even if it is weird it just is weird maybe i.
[16:38]Should let you keep going and describe what are these parameter options that we're going to be putting in here
[16:43]So there are lots of them but i'm going to just tell you that they there are many of them but the three coolest or the three most useful, the three I have found was of actually needing are one of them we've already seen, value from pipeline equals true. So that means that whatever arrives into our function from the pipeline is going to be this parameter. So we saw that last week when we piped, two weeks ago, when we started piping numbers into our get double value function. So if you scroll back up to get double value, you'll see that, oh, look, we had that weird syntax. I just yadding at it past it.
[17:25]Hmm. Okay.
[17:27]So you could see the last thing we sort of did near our break was that we made our function get double, so it worked with the pipeline. And we gave it the numbers one, two, three, and we piped those straight in to get double value and then we piped those in to get sum. And inside pipe double value, those numbers that got piped in became dollar number. So one got double.
[17:54]You're asking for something very challenging. In the middle of trying to follow everything, you're saying you want me to scroll away from where we are and find it again. So I'm not going to do that. I have instead opened the document in another text editor to try to go backwards to figure out what you're talking about. So, yes, you did use it.
[18:14]Yeah, and I hand-waved you past it.
[18:17]Right, right.
[18:18]Well, now I'm telling you what it really does. So it's one of these options. So we're basically saying that...
[18:25]Let me try to say what I think you said it was while I was trying to listen and open the document again. A three-way tie. um the parameter options this parameter option is saying you're going to get something from the pipeline and i'm telling you you want to take it
[18:42]I think if it's slightly from the other point of view something arrives at the pipeline and parashel says what do i do with this and you're saying me me me me me me i want that oh okay plug that into me this.
[18:56]Param wants this parameter value from pipeline equals $true. Okay. Do you have to set the other ones to be $false?
[19:09]You could, but you don't have to.
[19:12]You don't need to.
[19:12]You don't need to. Basically, it's an opt-in.
[19:15]It could potentially go to more than one, though.
[19:19]No. That will make Parashel go, so I'm sorry. Think about it this way, Alison. The new data coming in is a male plug, and you're saying, I volunteered to be the female plug so that whenever something comes in, it slots into me. Click.
[19:36]But what if I want to use this input number that's been given to us. I want to use it to add that number to something, and I also want to have it multiply something. I can't do both.
[19:47]But it only needs one name, right? It's called dollar number, and whatever you want to do with it, it's now just a variable.
[19:52]You're just assigning it to a variable. Sorry. Gotcha, gotcha, gotcha. Would make, well, I guess you could put it to, but no, okay.
[20:01]If you really want to, you could start the function by saying dollar my other name equals dollar my first name, right? And then you've just duplicated it.
[20:09]Okay all right
[20:10]All right where was i because i did scroll because i'm silly so that's the first one is value from pipeline the second one is position equals this is how you say hello i'd like the first unnamed argument please connect that to me so position equals zero says give me the first one with no name that'll be my value position equals one give me the second one with no name so that's how you basically say whatever they passed and didn't bother giving a name the first one goes here the other interesting thing you can do and i haven't got an example in the show notes because it's kind of an advanced thing but i do mention it higher up in the notes and forgot to say it out loud is that you don't have to assign the positional parameters to individual variables you can make one parameter as long as its type is an array and say i want all the positional parameters give me everything i'm an array and i want all of the ones with no name just send them all to me i'm not that will then be an array really.
[21:21]Following this positional parameter thing very well um i don't
[21:25]There's an example coming okay.
[21:28]You move on to the third one right away and so i'm not gonna that's why i was gonna
[21:32]Stop you i'm gonna give you an example that was all three so i'm gonna give you an example okay but okay let's back up then so if you say, oh ah i can be very specific so the command to print a message is write-host and then we give it a string. We didn't give it a name, we just gave it a string. That's a positional parameter. Right, but why would something want that positional string? So inside WriteHost, the code written by Microsoft to make WriteHost do its thing, inside that code, that thing you put there has to have a name so that it can actually print it to the screen. So under the hood, it has mapped that to a named parameter, which I happen to know from the documentation is minus message. So that's actually the same as saying writehost space minus message space hello target.
[22:37]What's that got to do with what position it is?
[22:39]But we didn't bother giving it a name.
[22:40]Yeah, we did. We called it target.
[22:43]No, no, that's its value. We said write host a string.
[22:51]Yeah.
[22:53]So look only at line five, right? The write host line. Write host is a function. We are calling it with one argument a string. That could be waffles. And then I would just write waffles. okay so there is one argument there a string we did not give that argument a name.
[23:17]But there's a parameter inside it, and it's not... Do you mean argument or parameter? Or is that the same thing?
[23:28]It's the same thing. Okay. So this is a string that we happen to be giving... We're building the string that includes...
[23:36]A parameter. ...dollar
[23:37]Target, but it could just be hello or hello world.
[23:40]Okay. So we've done right. righthost string you're saying that string doesn't have a doesn't have a a name
[23:51]It's not a name parameter we haven't given it a name we've just thrown a value at righthost so how does righthost know what to do with it well the people who wrote righthost they inside righthost had to give it a name and they gave it a name by saying the parameter of type string named message accepts It's position zero.
[24:16]Okay. Okay. It's a lot of layers of abstraction, but I think I follow you. Okay, let's keep going. See if we can do number three, and then maybe I catch up when you put all three together.
[24:27]Number three is a nice easy one. Is this parameter mandatory? So if you say mandatory equals true, then you're not allowed not to give that parameter.
[24:39]Makes sense.
[24:39]Or the function just goes error. I'm sorry, I needed one of those, and you didn't give me one of those.
[24:43]Mandatory equals $true, right? Okay.
[24:46]Yeah. So let's update our getDoubleValue function so that it does all three of these things. It will accept the pipeline and it will accept position zero and it's mandatory. So we're saying... It, it, it. The parameter called $number.
[25:07]Thank you.
[25:07]Of type double has the three options, value from pipeline, position zero, and it's mandatory. So we can now call get double value by just saying get double value five. And it will know, oh, position zero is mapped to the name dollar number. Okay. Dollar answer equals dollar number multiplied by two. Write host, the number doubled is dollar answer. Write output dollar answer.
[25:43]So the value of that back to this position equals zero thing, we have to tell it that because that's the, we're saying capture, but we already took value from pipeline equals true dollar true. Why do we have to also tell it position zero? I thought we already grabbed it.
[25:59]Okay. So look at how I am saying get double value five. There's no pipeline there. I'm not piping, I could say five pipe to get double value, and then I'm making use of value from pipeline, or now it has a new superpower, I'm just passing it as an argument, as a, positional parameter, get double value space five.
[26:23]So we don't need value from pipeline equals $true for this command to work.
[26:29]For this specific invocation of the function, we are not making use of that option.
[26:35]We are instead making use of position equals zero. Thank you. Because I was trying, it seems weird to have them both in there. But what you're saying is you can pipe it to me or I can take the first one. So that's both options. Okay.
[26:49]Right. You're trying to be flexible, right? What you would like is your functions and your commands to accept input in all different sensible ways. Don't make the developer do work to use your function.
[27:00]Got it. Got it. And mandatory equals dollar true. Duh. You can't double a number you never gave me. Okay.
[27:05]Precisely precisely so why should you go to this effort to give your parameter to define your parameters in this rigorous way you're giving them a name you're giving them a type you're setting these options what's what's the point of this the first bonus you get is that the power shell shell can actually help you so if you are missing a mandatory parameter and you hit enter, that the shell will ask you for the value so if you copy and paste that get double value function into your shell first and then run it without a parameter just say get double value and hit enter you've now done something that it can't do but it knows dollar number exists and it should have a value so it will ask you for one i'll just prompt you give me a number can.
[28:03]I ask you a dumb question while I'm trying to do this. No. How do you get it to, how do you get PowerShell to accept the auto-complete it's offering me? It shows it to me, but hitting a tab doesn't do anything. Oh, right arrow? Right arrow. Ah, there we go. Thank you.
[28:19]Sorry, I had to actually think, because I do it so atomically. It's like when someone asked me, actually, I ended up, I had to sit down and take the laptop off the better half, because he asked me a very simple question. How do you move backwards between windows? Oh no, how do you move between windows in the same app on the Mac? And I was like, oh, it's easy. You just, uh.
[28:40]You had to go ask your fingers.
[28:42]I had to go ask my fingers. Yeah.
[28:46]Okay.
[28:46]I can't say my own pin number. I have to just imagine a little grid of nine, and then I know what it is. Anyway.
[28:52]So this is supposed to be spitting the answer out twice, correct? Three doubles is six, six. Five doubled is ten, ten.
[29:01]Yeah.
[29:02]Okay.
[29:02]Yes. So one of those is the right host, which is the text to you, and the other one is the actual output going to the... We could be piped to the next command.
[29:12]Got you. Okay.
[29:15]So if you run gettable value and you don't give it any arguments and you hit enter, PowerShell doesn't just throw you under the bus. It goes, well, you said I need a number and there is no number here. I'll just ask you.
[29:28]Yeah. And it says supply values for the following parameters. Number.
[29:33]Yeah. And let you type it in. And if you type it something wrong, it will be able to tell you, sorry, no, no, no. no, you're supposed to be a number because we've told that it's a type double. So if you type in waffles, it won't be happy.
[29:45]I typed in L, get double value. Can I process argument transformation on parameter? I must convert it to system. Well, it's not a very friendly answer.
[29:54]It's not the word's friendly, Sarah, but it is telling you. Oh, wait, there it goes.
[29:56]The input string L was not in the correct format. Could have told me it wants a number, but still.
[30:04]Well, this is why you give parameters good names, right? We did literally say, hey it's looking for a parameter named number so that's pretty friendly, anyway that's a nice thing the other thing you can do is you can actually tab complete a named parameter so if you say write error space minus m and hit tab it will complete that to minus message, because that's actually what's going on with write error but it can do it on any function so it can do it and get double value so if you say get double value minus n and hit tab it will tab it out to minus number.
[30:47]Wait get double value
[30:50]Space minus n and just hit the tab key, minus m n you're starting to type number but you don't remember or what was the full name of it? And hit tab, and it will tab it out.
[31:08]Okay.
[31:09]Because it knows. It knows what you want. The other thing is that all of your IDEs can read these parameter definitions. And so the tool tips and the autocomplete suggestions, they all know what parameters to offer. So they can be really helpful in telling you what to pass to this function. Because you've literally told it, this function needs a number, right? Mandatory equals true. And so the inside inside vs code it can give you all that stuff and autocomplete it for you or offer it as an autocomplete etc so it really helps ides be helpful and the other thing is there's actually a built-in help command so instead of hoping that developers write a man page with powershell you get a pre-built basic help page for every single function you write because you have to define these parameters. So at the very least, it can help you get the parameters right. And as we'll learn later, you can make the help way better. But out of the box, everything knows its own parameters. So you can say get-help space any PowerShell command, any PowerShell function, and it will tell you what it knows. And so if you do get help double value, it will tell you it takes a parameter named number.
[32:33]Wait, get help double value or get help get double value?
[32:37]Sorry, get dash help space full name of the function or the command or whatever you're looking for help with.
[32:45]Which is get dash double value? Yes.
[32:48]Yeah, we named our function get dash double value.
[32:51]So it's not telling me everything. It's telling me it's a number and then it says double and then it says common parameters. It doesn't tell me all my parameters.
[33:02]Well, we only defined one. we only define the parameter number the function get up a value only defines the.
[33:09]Value from pipeline equals true position is zero mandatory dollar true we put in three parameters
[33:15]No it's one parameter with three options the options are i can take the pipeline i will take position zero and i am mandatory but i am one parameter named number.
[33:26]This is back to param is explaining the parameter but parameter is not explaining the parameter it's telling you things it could to do with it or what it's going to accept yeah
[33:40]It's describing so it's come before dollar number so it's describing what dollar number will be and then you finally say and we're calling it dollar number.
[33:51]I think this is frustrating because every single other thing you've told me about power shell the the words make sense this is the exact opposite of sets Param is the parameter, and parameter is not the parameter.
[34:07]I'm not i'm gonna argue it makes sense it yeah it's you got strange syntax but it's very powerful oh yeah you see it everywhere so it you see yeah it becomes second nature yeah okay.
[34:21]So it's not intuitive i do like the idea that git dash help is going to tell you about it but it doesn't seem like it told me very much about it it just told me it takes a number
[34:31]Right but literally all we've done as a developer is say that this is a function that takes a number and get help has just magically learned that we haven't done any extra work to help it in any way right and we can make our help better so if you say get dash help say for write dash host which is a built-in function you'll get much more documentation because microsoft have provided more than the basic but what.
[35:03]What does it mean it says syntax get dash double value square bracket dash number okay that's the variable name that it's expecting and then it says uh greater than symbol double less than symbol or vice versa you know i mean angle brackets double i don't know where it Got double.
[35:23]That's the type.
[35:24]Oh, that's the type. Okay. Okay, sorry. Yes, yes, yes. Okay, and then it says square bracket, angle bracket, common parameters. What is that?
[35:34]So common parameters are something I'm about to talk about in a few minutes. Okay. So common parameters are things that exist in every PowerShell command.
[35:43]Okay.
[35:44]That's why they're called common parameters. Okay. So, the reasons that it's great to formally define your parameters are that the shell can help you, your IDE can help you, and the help command can help you. And you just get all of that for free by defining your parameters. And it's very powerful.
[36:06]So the other thing we have is these common parameters, and they give us consistency, right? So in the universe of Bash, we have convention. And a great example of this is minus V.
[36:20]Lots of commands obey the convention that minus V means verbose mode. Tell me what you're doing. And minus VV means very verbose, and VVV means very, very verbose. But on some commands, minus V means print the version number. Oh yeah still minus v but there's no actual standard it's just convention okay, power shell provides you actual standard common parameters so every single power shell command has a bunch of these standard parameters and they are documented there's a there's a link in the show notes to the document and it just lists them all so every single power shell command has these common parameters and that is just very useful but it's cooler than that you can adopt them you can simply say yeah do you know something my functions should behave just like microsoft ones i'm going to adopt these common parameters into my function oh and you do that by just starting your function with square bracket command let binding open close round bracket close square bracket and that one line says just adopt them all pretend i typed all those parameters into my param statement just take them take the standard parameters and bring them into my function but.
[37:42]We didn't do that and get dash double value and the help says that we did says common parameters
[37:50]By not doing it explicitly, we've taken them, but only as a pass through. So that means that if we call inside our function, one of the standard functions, we'll pass through the standard parameters. But we're not really using them in our own code. Okay. I'm just going to ask you to let me wave my hand at that one. Good, yeah, hand-waving accepted.
[38:22]Yeah.
[38:23]Okay. There's a really subtle difference, but too subtle. Let's not take that.
[38:31]
Leveraging Common Parameters in Functions
[38:32]So let's illustrate the power of the standard common parameters by adopting minus verbose, which is the power shell equivalent of one of the two minus V conventions. So the one for verbose is minus verbose and so if you start your function with commandlet binding your function now has a minus verbose switch you just got that for free and this allows us to change so at the moment you notice that when you ran get double value it printed some english telling you what it had done dollar number double d is blah blah and then it wrote the actual number to the output stream but that's noise right unless i was debugging my function i don't actually want it to tell me what it's doing i wanted to just take the answer and shove it into the output, so really that message should be a debug message, so that means we shouldn't be doing write host we should be doing write for both.
[39:38]But how do we make that actually behave itself? And the answer is we simply say, use the commandlet bindings and then just change the function to write for both. And now it will behave like a standard PowerShell function. So if we call our get double value with any value, it will just give us the answers. It'll just, so if we call it with one, two, three, four, five, it'll print 2, 4, 6, 8, 10. And it won't show us that text. Oh, that's funny.
[40:14]I was thinking you were going to do the opposite. To me, the verbose one was throwing that extra dollar answer at me.
[40:21]Right, so by default, it now doesn't shout at us. But if we want to debug our code, we can now say minus verbose. So if we take those same numbers and pipe them to get double value minus verbose now it will, show us the extra text so when you're writing your own code i my code is full of minus verbose statements absolutely full of them and while i'm working on my script i run my own script with minus verbose and i'm watching it very carefully what's going on here and then when it goes into production it's quiet it only tells you important information warnings and errors in your actual outputs it's not yakking away at you all the time yeah okay the other thing you'll have noticed is that when you run this when you do run it with minus verbose the debug messages are explicitly marked as being debug messages yeah they say square bracket verbose close square bracket and they're in yellow no.
[41:25]It doesn't have any brackets on it but it's all in capital letters verbose colon one
[41:30]Double is two and it's yellow okay yeah it's yellow sorry it's not square brackets it's just the word verbose and it's yellow the yellow is particularly what six in my head, because yeah yeah it's quite noticeable so there are lots of these common parameters but in my experience there's three of them i use all the time so minus verbose is how we do all of my debugging it's really cool there is an amazing one any power shell command that does irreversible changes or sorry not irreversible just destructive in any way so delete change they will all have minus what if which means do this tell me what you would do and don't do a bloody thing.
[42:19]So if you want to write a script to clean up your home directory if you adopt the uh standard commandlet bindings you can then have your function be able to be run with minus what if, point it out your home directory and instead of it deleting files it will tell you i would have deleted this and i would have deleted that and then you can be sure okay so my script to clean all files other than six months is doing exactly what i thought and then you rerun it without the minus what if, and it will actually do deletions. So in the real world, none of my PowerShell scripts that in any way change things.
[43:02]Don't support minus what if they all support minus what if and everyone knows that if bart wrote the code you can safely run it with minus what if and it won't break anything so i just tried running our.
[43:14]Get double value with what if and it's barfing all over at me it doesn't like it
[43:19]Right correct because we haven't implemented what if because double value isn't destructive so but we in order to use what if we have to give a little bit more information to commandlet binding so we have to say commandlet binding and we're opting into what if, but i haven't shown you that here because this is just a little quick um okay you know this is just a teaser uh but if you think about it gettable value is getting something so it's non-destructive, okay so none of the power shell gets have a minus what if because they're not destructive so.
[43:52]There's something we have to type into our code it's something the developer of the this shell of the shell script has to enable
[44:00]Yes okay yeah so when you're writing destructive code it provides you and they're very very it's very simple to do but you basically need to wrap the parts of your code that do that do damage is the wrong word that make changes you wrap those in a function and then you give it a piece of text that's the alternative so i'm about to do this dangerous thing or do this dangerous thing. And when you run it minus what if, it just tells you what it would do. Otherwise, it actually runs the function. And so you define the two pieces.
[44:36]What it would do is the text that you said. Like, I'm going to delete everything in this directory. Yes. Okay.
[44:44]Yeah. And yeah, it's very powerful. And when you combine minus verbose with minus what if, you get really good debugging. Because you're telling me in great detail, I'm doing this, I'm doing this, I'm doing this. I would do this horribly dangerous thing. I would do this, I would do this. And then when you're happy, you take those two flags off and you let it rip. It does whatever it is and without it breaking everything. Like, managing Active Directory is older than PowerShell. So, cleaning up old accounts, you don't want to get that wrong. You don't want a star in the wrong place, right? Speaking as someone who once emptied the domain, that was in the days before PowerShell. Terrifying. The other really powerful one is minus error action, which tells PowerShell, if there's an error here, what do I do? Do i show you the error and carry on regardless or do i stop the whole script here okay and so if you're inside a loop you may want the error action to be continue it's like i want you to loop over these five things and if one of them fails don't kill my whole script but you know something there are lots of times where i want if anything goes wrong in this script stop don't keep going don't try to keep going stop and you do that by saying minus error action stop.
[46:11]Okay and you're basically saying this is fatal just now go away right right right a good example is connect to database if the connection to the database fails do not run the rest of the script because they're all going to fail exactly so that they are some of the common parameters and it's great that they're the same everywhere, and you can adopt them into your own code easily, which means that your code can behave like everyone else's code. So when you download someone else's PowerShell and they're not idiots, it will behave just like standard PowerShell. It's wonderfully refreshing. That consistency is amazing. So I mentioned that the get help system is there well you can do way more than just what it does by default you can literally add comments in front of your function to add the documentation.
[47:13]And you basically, you just put a big multi-line comment and it has a specific headings you give it and they will output the right values. So if you just go get help double value, you've already seen it says name, syntax, aliases and remarks, and they're all none. Because we haven't added any of these special comments to our function. Right we've it's just default so it gives you very bare answers but if you did the same for right error it gives you a lot of information a lot of information and the scary thing is if you want even more you can run it with minus detailed or if you really like scrolling minus full, you get insane amounts, the other thing that I say in my show notes that I forgot to say out loud is if you have a brand new install of PowerShell you may need to once run the command update-help and that's going to download the extra details from Microsoft for write error and all the standard functions.
[48:29]Update-help is it capital H or something?
[48:34]Capital U update dash capital H help.
[48:39]All these capital letters is odd. No.
[48:42]It's always Pascal case. Capital U P.
[48:44]D A T E space dash capital H E L P.
[48:47]No, no, no space. No, no. Update dash help. It's for, it's not a flag.
[48:52]It's a, yeah, got it. Okie dokie.
[48:58]So now if you're on get-help space write-error space minus full, I don't want you to read it. What you'll notice is there's a lot of it.
[49:08]Yeah.
[49:10]So you have that level of documentation for all the standard commands. What I find much more useful is the minus examples flag, which allows you to only see the examples of how do I use write error? So get dash help write dash error minus examples 99.9% of the time just show me some examples and I'll figure it out yeah yeah so we can add this level of documentation to any of our own functions the only minor thing is they need to be in a file for the comments to exist to be able to give the help so this is for your scripts so if we turn get double value into a script by sticking into a text file with the dot ps1 extension then we can add the comments and the comments are very englishy so it's a period followed by the field you're defining so dot synopsis for a little one sentence really pithy description dot description you're allowed to be nice and chatty you know That could be multiple paragraphs.
[50:27].parameter number. You don't have to tell it the type and stuff, because that's all down in the code. But you can give it some English, so you can write a description of what number is. In this case, the number to be doubled. So you can give it a little English description.
[50:44]Number in this case doesn't have a dollar in front of it. That seems odd.
[50:48]It doesn't, because on the command line it won't either, right? It's going to be minus number.
[50:53]Right, it's got a minus in front of it. So it's got a minus in front of it. We said then it's a dollar inside. Now this has nothing at all. That's, it's okay.
[51:03]It's okay. Yeah. It is. Dot outputs is how you describe what the pipeline will spit out, what it will put into the pipeline. And the line above it, which I skipped over, is dot inputs, which is what it will expect to receive from the pipeline. So our function expects to receive a number from the pipeline so we say it's type system.double values from the number parameter that's not very descriptive.
[51:32]A little bit here that it's got periods in it like it's a sentence but it's not a sentence it's an official thing system.double. Values for the number parameter dot is this just English?
[51:48]The second bit of it is system dot double dot is is you telling it the type with a sentence.
[51:57]That isn't really a sentence
[51:59]Okay and then all the other sentences are sentences yeah you can have as many of those as you like i can i.
[52:06]Can still see it but i want to make sure that didn't have i mean you could leave it off it would just be harder to read or no i might
[52:15]Barf oh i'm trying to remember there There's a special word you put there instead to say, whatever, not going to tell you this. Just, I don't remember off the top of my head. Okay.
[52:26]Do you have a text expander snippet for all of this? Don't nod your head on an audio podcast, Bart.
[52:33]Of course I do. Yes. In fact, I have a couple, because sometimes I want functions that do use the pipeline, and sometimes I want them that don't use the pipeline, so I have a few different snippets to give me the different templates. But yes, yes is your answer. Dot example, you can give lots of dot examples. They become the examples that you then get when you run it with minus examples. Are they just text? And there's actually...
[52:58]Or these have to be precise.
[53:01]No they can just be text the convention is you put the command in a ps prompt so ps arrow our angle bracket and then the command and then the rest is by convention the output but you could write waffles pancakes it will be a very useless example but you could write whatever you like, okay and then we just copy and paste in the rest of our function right the rest of the code is exactly the same and now we can get help on dot slash get double value dot ps1 and now it gives us a proper description so name is the path of the script synopsis is our synopsis the syntax it worked out for itself the description is our little paragraph we didn't specify any related links and then the remarks give the user some information for how to see more value a nice one is minus examples which is suggesting to us and if you do that then you'll see the two examples we added in our little comments oh.
[54:05]That's interesting so the examples aren't part of the regular help you have to explicitly ask for examples
[54:11]Or say minus detailed or minus full, not verbose so minus detail gives you more information than you get by default minus full gives you everything,
[54:31]
Utilizing Help Documentation in PowerShell
[54:27]and minus examples cherry picks to just the examples okay.
[54:32]I see a lot of space in the output like there's empty space that you didn't put in your in your file
[54:42]Yeah, PowerShell on the terminal uses space to tell you, I'm ending a section and I'm starting another section. Because it can't make the text bigger.
[54:52]It's giving two lines each time.
[54:54]Yes. Yeah, so that's its way of saying, pretend I could write a big heading. But it can't write a big heading, so it puts a big space.
[55:02]Except when it doesn't. Sometimes it only gives one line. That's odd. I was starting to fix it, thinking it was a typo of yours, and I thought, maybe that's what it does. Okay.
[55:11]I don't know that is what it does. That is what it does. You'll also notice that if you go to the official API documentation, it's a very pretty web page, but the headings are all exactly the same as they are here. It's just it's a nice HTML page, in which case it doesn't have all the spaces. It can do nice presentation with code tags and syntax highlighting and stuff. But it's the same information that's getting translated to HTML. So the developers are writing these comments and it's being spat out as a shiny web page or as the output of the help command. So the get help command. It's very powerful. And if you get into the habit of writing these comments on your own code, your IDE will show you the same information when you hover over it. So as well as telling you this function expects a parameter named number, it can also put the text because it can read those comments. So VS Code will read those comments and include all of that in the little hints it gives you. And so if you start writing code and sharing it with colleagues, they'll get a lot of help from your comments. Okay. It's very powerful.
[56:23]So the other thing you'll notice, I think you've called attention to it a few times, is there's a lot of consistency here, right? So everything is with its leading uppercase letter, right? It's always Pascal case, which is like Camel case, but with a leading capital. And PowerShell is very opinionated. So much so that if you're only writing code for yourself, you can kind of get away with being loosey-goosey. But if you tell PowerShell import this module from elsewhere it will check the code against the conventions and it will give you warnings it won't fail to import it it'll just tell you by the way this code you've just asked me to import has a whole bunch of functions with non-standard names this this code is not going to behave the way you expect basically and the result of that is that all of the code you get sharing GitHub and stuff does follow the convention because otherwise it just shouts at people all the time.
[57:32]So you get this consistency everywhere. So it's all Pascal case. The other thing is this verb noun thing, that is not just everywhere, but there's actually a list of verbs. And it's a really well-written document because it tells you by new, we mean blah, blah, blah. If you actually meant this other thing, you should use this other verb. And so it has a disambiguation section for similar verbs and actually no there is a subtle difference between create and set and these kind of things new versus find versus search huh yes and it describes the difference and there's also sections so when you're processing data there's data verbs and it tells you the verbs you should use for when you're talking to a database or whatever and connect and disconnect and a bunch of other things and And then there's verbs for managing something being published and unpublished and stuff like that. So it breaks the verbs into categories. So there's a lot of great consistency.
[58:41]Security verbs. Interesting.
[58:43]Yeah. So the result is you could almost guess. So if you have a convert2-csv it doesn't take a genius to know convert2-xml will do an xml conversion and convert2-json will do a json conversion right so this consistency is very liberating it really helps you write your code and to use other people's code and as i've hinted already, there is a very powerful module ecosystem. So you can bring in other people's code in a very controlled way. And so there's something called the PowerShell Gallery, which is the equivalent of NPM, which is this amazing place full of cool packages that are just sitting there for you to use. So out of the box, you get import CSV, import JSON, and import XML. But what if I want to import an excel file well there's a module called import excel so you say install that module minus name import excel and you will now have a new command that you can use called import dash excel so.
[59:56]Right inside power shell we don't have to be homebrewing that or anything
[1:00:01]No you can pop that into your power shell and it will then install it actually installs it into your home directory so there'll be a directory in your home directory called PowerShell modules and the code you install goes into the PowerShell modules folder. And so if you get something horribly wrong, it's only in your home folder. So you're just blown away, start over, make a fresh modules folder. It's very powerful.
[1:00:26]So the last thing in the show notes, and I don't know whether or not we want to talk through this in English, but the show notes end with a section called a very basic syntax primer. And it's just some examples of how you do the different things like comments, defining variables, creating arrays, creating dictionaries, or hash tables. Something that's takes a little getting used to the operators all are in the bash style they're a minus whatever so it's not double equals it's minus eq, if you want case insensitive it's minus ieq and if you want case sensitive it's minus ceq, you've minus like for uh your star dot whatever style command line syntax or minus match for regular expressions so native regular expression supports you can see why i like this right oh minus lt for less than minus gt the.
[1:01:32]Operators aren't in pascal case bart
[1:01:35]Yes which makes them really stand out in your code yeah.
[1:01:38]I bet i bet yeah
[1:01:39]Yeah that's a very deliberate decision and it's very obvious i.
[1:01:45]Realized the other bring up regular expressions i realized the other the other day that i'm never going to write one again i will have chat gpt write them for me i will never try
[1:01:55]To i was just going to say you're going to use them as much as ever maybe more yeah.
[1:01:59]Yeah right you're going to write them yeah okay i
[1:02:02]Don't disagree yeah and it's a It's a lot easier to look at one and tweak it, than it is to start with an empty page and go, ooh.
[1:02:12]Yeah, yeah.
[1:02:15]So at this stage, I'm hoping that if you're interested, you're interested. So the next thing in the show notes is some next steps. And I think the most important thing is to bookmark the landing page for PowerShell on learned.microsoft.com, which is linked in the show notes. And that page is the home of everything to do with PowerShell and it's a really good page to get to know well. So I'm just going to point out that you have a dropdown at the top for your version. By default, it's going to be the current long-term support release, which is what you're going to have installed by default. So most of the time, you don't have to touch that dropdown. But if you're debugging a piece of code you wrote a while ago, So maybe you want to change that back to 5.1 and see how the world was then. You can do that.
[1:03:05]Does it auto update? My PowerShell is going to say, hey, you're on an old version, want the new one?
[1:03:12]Uh homebrew will yeah homebrew will let you update.
[1:03:16]Homebrew is give me updates
[1:03:19]Powershell will shout at you when it's out of days and it will tell you please
[1:03:24]
Navigating PowerShell Documentation
[1:03:23]use homebrew to update me okay.
[1:03:25]Good that's that's auto update my book yeah
[1:03:28]Yeah yeah so depending on your definition yes um so when you're in there so you have that drop down that's useful the other very handy one is filter by title where you can just start typing things so that's always healthy so you know anyway yeah sorry it's a it's a filter box i don't need to describe how a filter box works, but there's some sections in there that i think are particularly useful so the top level section learning power shell is really good for a beginner.
[1:04:04]So that's kind of where the PowerShell 101 subsection is a really good place to start and the deep dives like if you want to understand how does PowerShell think about something the deep dives are fantastic it's like well what does PowerShell mean by a hash table go to the deep dive on hash tables or whatever it's and you'll get a really detailed description and then the other one I think is really important is the reference section because that's where the API iDocs hide and the the stuff you care about like the write-host and all those standard commands they're microsoft.powershell.core so if you go into microsoft.powershell.core in the documentation you're going to see all the standard commands in there very powerful and the other useful one is microsoft.powershell.utility those core and utility that's where the vast majority of the functionality hides so armed with that the documentation side is very useful and that's what i do, well no okay i do a couple of things just power shell space what it is i'm trying to do into ye olde google works great because there's an awful lot of really good stuff sitting on stack overflow and if you take the function name and look it up in the api reference.
[1:05:22]Between that and stack overflow you'll always get what you need So Stack Overflow will tell you, oh, you need the blah, blah, blah command. And then you're like, well, what does the blah, blah, blah command actually do? Let me look at the API doc and it will show me all the different parameters and everything. And let me figure it out from there. So I usually start on Stack Overflow and then read the manual.
[1:05:43]Because especially if it's a, you know, how do I write a PowerShell script to delete users from the domain? Well, I'm going to go read the actual docs just to make sure I'm doing what I think I'm doing. You know, don't trust these people on Stack Overflow unthinkingly.
[1:06:01]So that, yeah, so we ended the first half by saying, if you're interested, give us a shout on podfee.com forward slash Slack. And spoiler alert people did and the answer is yes yes we are interested yes this is cool yes we want to do this so that's a little segue into our plans for 2025 and so we are going to do PowerShell but it's part two of my agenda for 2025 for a couple of reasons I need to do the thing on part one of the agenda for a few different reasons so I kind of have to do that first and also the first thing we're going to do the story is in my head so I can start writing the show notes I know what I want to say about PowerShell but I haven't figured out how to turn it into a narrative where do I begin and how do I step through it so as to have maximum understanding and minimum confusion. And it's not straightforward to do that, to tell that story. It took me a while to get the story right with Git and with Bash. And so I need some more time to plan how I'm going to do PowerShell. So that's why PowerShell is second.
[1:07:20]
Upcoming Topics for 2025
[1:07:20]So I'm going to give you a teaser of the mystery thing that is first, and that is GitHub Pages.
[1:07:28]So there are a bunch of reasons why you might be interested in joining us for a journey through GitHub pages. And the first of them is that I'm going to teach you how you can all get free web hosting. Surprisingly powerful free web hosting on your own domain if you want, which is pretty cool. The other thing is, you've been listening along to this series for an amount of time. Maybe this is your first ever episode, but probably not.
[1:07:57]That would be a very weird place to start.
[1:07:59]It would, wouldn't it?
[1:08:01]All the episodes you should not start with is probably this is near the top, halfway through a story.
[1:08:09]Yes. So what you see is a pretty webpage. And what me and Alison write is a bunch of markdown.
[1:08:19]How does the markdown, and a lot of our listeners contribute typo fixes to the markdown, and they'd make a pull request. I accept the pull request, or Alison accepts the pull request more often. Alison's way better at that than me. I'm much too slow. Sometimes I get to, but usually Alison does. Or when we take your pull request, the website magically updates. We're not updating any HTML. we're just saying yeah that markdown is fine and then by some magic this pretty web page appears well it's not some magic it's a bunch of really cool technology which is github pages so that's we're going to demystify what happens between pull request oh look i'm on a pretty web page it's quite a bit happening in there uh the other thing is that github pages is a full featured content management system that doesn't need a database it doesn't need hosting with php or some other server-side language it allows us the same feature set in a completely different way so it solves the same problem totally differently it's a completely different way and that has there are swings and roundabouts i'm not saying that this is better than the other they're different and one of the advantages is there's no infrastructure for you to manage you don't have to have a database which i mean it's not difficult to have a database but it's work it's.
[1:09:47]Static yeah not dynamic and so there's no there isn't any need for a database right
[1:09:52]Exactly so it's a very different way of achieving that end and yeah so the technology is less complicated or different complicated the infrastructure is less complicated that's the right way to say it the other thing is that github pages has full support for a technology that enables us to fully utilize bootstrap so i have been living in dread of someone asking what may or may not seem like an obvious question in hindsight I don't know.
[1:10:28]We've learned a lot about Bootstrap and we've made lots of example Bootstrap pages and they all look like Bootstrap pages. They have a look that is identical in everything we've done with Bootstrap. Now, the website for this series doesn't look like those examples. But it's 100% Bootstrap. The Bootstrap homepage doesn't look like our examples, but it is 100% Bootstrap. Bootstrap wrote their web page in bootstrap so this implies we're missing something, we haven't touched on bootstrap's customization it's designed to be customized and we haven't done that we've taken it out of the box and the reason is because we're missing a technology something called sass which is a cool name so it's a sassy technology right sass.
[1:11:23]Is in software as a service
[1:11:24]No so it's s-a-s-s not s-a-a-s okay actually it's interesting that we call s-a-a-s
[1:11:41]
Introduction to GitHub Pages
[1:11:35]sass because really it should be sass that doesn't sound good so maybe that's why you're.
[1:11:41]Giving me some sass so the first thing you want to do is explain github pages secondarily this this bootstrap SaaS thing that will allow us to style pages even in a static service like GitHub Pages?
[1:11:57]Yes, GitHub Pages provides us SaaS. So GitHub Pages out of the box can do any SaaS. Bootstrap is our support SaaS. You customize Bootstrap with SaaS. So basically, GitHub Pages is ready for doing that extra cool Bootstrap stuff. We get it for free with GitHub Pages.
[1:12:17]Okay. So the connection of those two things together, you said you'd be interested in seeing XKPassWD have some style that isn't just... Yes, I would. Guess what? We're a bootstrap website.
[1:12:32]Exactly. Yeah. And as we'll say, the customization in bootstrap is really cool. And the reason it's called bootstrap is it's supposed to be a starting point. And we've just used it as an endpoint. But it's actually designed to be customized. You bootstrap your style on top of bootstrap. So.
[1:12:58]
Customizing Bootstrap with Sass
[1:12:54]Yeah, and so we're going to have to learn about SaaS to be able to do that. So SaaS is something we get for free with GitHub Pages, and SaaS is the mechanism for customizing Bootstrap. So it all sort of gels together. It's all kind of mushed into the one topic. And SaaS is a very cool language. It's basically CSS with superpowers, and the syntax is like CSS only better. So it's not really programming. It is markup, but it's very powerful. Anyway, SAS rocks. So we're going to learn all about SAS. So that is my little sneak peek of the intended 2025. I don't know about you, Alison, but I make lots of plans and I won't promise everything goes exactly as planned. But this is our intention for 2025.
[1:13:42]Yeah, we've taken a few diversions. I remember when we were going to do Python.
[1:13:48]I forgot we even planned that diversion. I know PHP was on our list. And yeah. Yeah, we've changed our mind a few times over the years.
[1:13:55]Yeah. Yeah. So we won't be doing PowerShell now. I'm going to put we may do PowerShell later. You say we will. But now we've put it out a ways out. Bart and I talked about this ahead of time. And I told Bart, have you ever noticed that I never do surveys? And the reason I don't do surveys is because it sets an expectation that you'll do what people asked for. And I don't want to do that.
[1:14:24]So you answered yes.
[1:14:26]And we're not going to do it yet. But he's given you the tools, and I think that's why you fleshed out the end part of the show notes to give a lot more tools to help people take that extra step up in PowerShell beyond what the tidbits brought you.
[1:14:40]Yeah, exactly. So hopefully this is enough for people who are genuinely interested to get stuck in and start being productive.
[1:14:47]
Learning PowerShell from the Ground Up
[1:14:47]And then you can join in. I mean a lot of the people who enjoyed our bash series had been programming bash for years and they still got a lot out of the bash series because we did it from first principles, and so the same is the intention to be true here for power shell that even if you're already writing some power shell you're still going to enjoy our dive into it because we're going to build it from the ground up and then all the pieces usually make more sense we got that feedback on javascript we got that feedback on git we got that feedback on bash so I think that's what we do we started at the basics and everyone learns something, even if you've been using the tool for years and years and years.
[1:15:24]I'm still convinced I'm the only person who started this whole series without knowing anything.
[1:15:31]So far in our community, yeah, it's all people who've gone, I dabbled and now I'm learning more. Whereas poor Alison started with, no, I genuinely didn't know any of this.
[1:15:40]Empty slate. Well, my Fortran 4 with Watt 5, it's going to come in handy one of these days.
[1:15:46]I'm trying to remember if there's anything we ever do with Fortran-style syntax, and I don't think there is. Pascal-style syntax. I don't think you were born. Oh, I did Fortran 77 in university.
[1:15:58]Oh, are you fancy?
[1:16:07]
Closing Remarks and Support Information
[1:16:01]That's the year I looked at it as not fancy because 1977 is like 1977 this is ancient.
[1:16:08]In the 1900s alright well we've been going on a long time we should probably close out but this sounds like a fun pass to me
[1:16:17]Excellent well folks happy new year and of course lots and lots and lots of happy computing.
[1:16:24]If you learn as much from Bart each week as I do I'd like you to go over to lets-talk.io IE, and press one of the buttons over there to help support him. He does 98% of the work here. I'm just the stooge that listens to him and asks the dumb questions. If you go over to lets-talk.ie, you can support him on Patreon, you can donate via PayPal, or you can use one of his referral links. I really hope you'll go over and help him out. In the meantime, you can contact me at Podfeet or check out all of the shows we do over there over at podfeet.com. Thanks for listening and stay
[1:17:00]Music

Error: Could not load transcript. Please try again later.

Reload

Loading Transcript...