Alright, so welcome back again. So in this particular session, we try to see how to work with optional argument, you think commander, right? So that's what we try to do. We have created our program, our variable call program is a constant variable, then we are going to present them with a superconductor, pass processor dot v. Right? Very interesting, unless the two were committed. So just want to create a sample description program, then this is going to go without question.
Id, patient 0.01. So we're going to be 0.02. Right? The first one was 0.01. And I'm going to give it my description. Not to be working with document.
Document. Right, that is it. If it's done in this one, it's going to be the user name so we can just give it us God's name. Now passing that name nemus sila, very interesting. So if I see it, I see it Here's one that I've done. And now I come back to my load, I see a lie that does help are going to get the various information.
So the question is the help and this is their description, we can hit Connect, which is referring to this particular option, right? Very interesting. Now let's see another set can also do so I go with division. I see that this is version 0.02. Very interested in a named misty and let's go to work at option two option argument two, let's click on that put an argument not mandate right. So they are not mandatory, non mandatory and the tree and then muscle every night with the dusters right there they have the destiny option, unless you have to create a simple document into the program, but option that is what you need.
Then I can just pass in particular back to school with the dash dash first name then can just keep it there. just wanting to shoot the long format, then I can just go with a short format, right. So to suit this, if that is all, then I give the description here I specify. Firstly, if it's if I see this particular setup done here now, and unless printed to see what you're done, so we'll come back to what you've done. To help with that our option. First Name is under our options path.
So I can actually run it like this. Firstly, then I can pass in the name to john pivot, but there's no showing anything because you're not attached to it. So let's see how to attach a machine to it. So to attach a machine could this go with this action, then I can pass in the action function. Very interesting. So let's take this.
Now let's see how to add an action to it to print out a particular value. So to print out the value ideas, come back to this option here. Then passing this value So this thing can be any name can be x, it can be Fox, it can be anything, but let's call it as value, right? That is, it makes sense to the user, then I'll pass this pass inside this value here. Very interesting, then I can print out something. So let's go with console.
Dot log in our passing. So let's say hello to the patient's face name, right. So it's going to be the name, body, dot, first name, XYZ with a space name that's going to identify that this first name is been stored inside. whatever value the person is typing, right? We attach the first name here, like a namespace like a dictionary, then I can bring it out using this particular option, right? So we have to think of this come up because you added an option to it.
And now let's run it and see so I'll come back to the same thing, right? So if I come back in, I run it here is the internet. We did Going to bring Hello john, right in very, very interesting. So the basic idea that we are touching whatever name or ballot is stored to our first name, right into our first name is a big idea, then I'll pass it, pass it off as global here, then I'm going to bring it out, you're going to see an option right interested. And this added an option to it is the last name. Then this is going to be last name.
Last name. l and this is going to be this L right as we get. Right. Very interesting. Then who can make it ln. Anyhow, you want it to be there.
Let's go. Let's specify last name. Very interesting. Right We have done something very interesting because I want to bring your last name to the Hello. Yo. First name, your first name or something, your first name If that particular value, then I can just go with this option of your last name is this.
So your last name your last name is patented is now going to be fixed against what the provider last name is. If I save it now and I come back to the same thing it cannot run it again. So we have our first name. So that's your last name on define right? Because we did not specified and this option is optional, right? To me, that is not mandatory.
I can run it again and passing the next one last last name is going to be Leslie Jones is going to bring Hello your first name is john, your last name is Jones very, very interesting. The basic idea about how to work with option argument using commander so we just go with the program that option, then the optional argument, then the value. to store data club value data type in a database go to specify the Didn't get a squeeze going to be the description. They're interested, then to bring out their results give good value towards that particular option. Right. So let's see another stickiness issue.
So when working with required option, let me is going to be like this required option to record options are optional items that are required right here or do they often augment but the Mr. Gamma nature the requirement. So let's go with the same thing for this one. Let's see. Sorry, right oh, let's give the status then you can just specify the list. So I didn't specify status or something like that. So this is going to be a required option, right?
Very interesting. So let's see this one and let's run it again to console dot log required. If I save it, then I come back to the same 10 I did. Let's run it again. And give us a new hour. required optional tattoos not specified.
So these are optional admits but once you bring the required option, none of them is going to run because this is a required option. Very interest as long as I bring the required option here it's a status the less passing value legacy single now is going to take I saw your name, your first name is john, your last name is Jones and required very, very interesting the basic idea about how to work with an argument and also how to create a required option. So in a nutshell, just going to put quando right then or require commander any I call it the need to create the basic information about the COI. Then you just go to the option the first name to the value and you pass it into your project. So thank you for watching and see you the next session. Stay blessed