Project 04 - Building Cypha CLI - A Ciphering CLI

Building Command Line Tools with Python, Julia and Nodejs Module 05 - Building CLI Tools - Projects
27 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€64.94
List Price:  €92.78
You save:  €27.83
£55.57
List Price:  £79.40
You save:  £23.82
CA$95.27
List Price:  CA$136.11
You save:  CA$40.83
A$107.88
List Price:  A$154.13
You save:  A$46.24
S$94.55
List Price:  S$135.08
You save:  S$40.52
HK$547.57
List Price:  HK$782.28
You save:  HK$234.71
CHF 63.42
List Price:  CHF 90.61
You save:  CHF 27.18
NOK kr759.63
List Price:  NOK kr1,085.23
You save:  NOK kr325.60
DKK kr484.38
List Price:  DKK kr692.01
You save:  DKK kr207.62
NZ$117.46
List Price:  NZ$167.80
You save:  NZ$50.34
د.إ257.02
List Price:  د.إ367.19
You save:  د.إ110.16
৳7,682.93
List Price:  ৳10,976.08
You save:  ৳3,293.15
₹5,837.41
List Price:  ₹8,339.52
You save:  ₹2,502.10
RM331.26
List Price:  RM473.25
You save:  RM141.99
₦99,285.71
List Price:  ₦141,842.81
You save:  ₦42,557.10
₨19,466.20
List Price:  ₨27,810.04
You save:  ₨8,343.84
฿2,553.28
List Price:  ฿3,647.70
You save:  ฿1,094.41
₺2,262.39
List Price:  ₺3,232.12
You save:  ₺969.73
B$349.43
List Price:  B$499.21
You save:  B$149.77
R1,335.92
List Price:  R1,908.54
You save:  R572.62
Лв126.45
List Price:  Лв180.65
You save:  Лв54.20
₩94,634.34
List Price:  ₩135,197.71
You save:  ₩40,563.37
₪258.03
List Price:  ₪368.63
You save:  ₪110.60
₱3,943.57
List Price:  ₱5,633.91
You save:  ₱1,690.34
¥10,600.67
List Price:  ¥15,144.47
You save:  ¥4,543.79
MX$1,161.53
List Price:  MX$1,659.40
You save:  MX$497.87
QR255
List Price:  QR364.31
You save:  QR109.30
P959.59
List Price:  P1,370.91
You save:  P411.31
KSh9,203.68
List Price:  KSh13,148.68
You save:  KSh3,945
E£3,310.52
List Price:  E£4,729.52
You save:  E£1,419
ብር3,976.27
List Price:  ብር5,680.63
You save:  ብር1,704.36
Kz58,526.41
List Price:  Kz83,612.74
You save:  Kz25,086.33
CLP$68,581.80
List Price:  CLP$97,978.20
You save:  CLP$29,396.40
CN¥506.04
List Price:  CN¥722.95
You save:  CN¥216.90
RD$4,144.87
List Price:  RD$5,921.50
You save:  RD$1,776.62
DA9,443.17
List Price:  DA13,490.83
You save:  DA4,047.65
FJ$158.28
List Price:  FJ$226.12
You save:  FJ$67.84
Q545.87
List Price:  Q779.86
You save:  Q233.98
GY$14,645.83
List Price:  GY$20,923.51
You save:  GY$6,277.68
ISK kr9,762.20
List Price:  ISK kr13,946.60
You save:  ISK kr4,184.40
DH709.20
List Price:  DH1,013.19
You save:  DH303.99
L1,234.28
List Price:  L1,763.34
You save:  L529.05
ден3,991.30
List Price:  ден5,702.11
You save:  ден1,710.80
MOP$564.10
List Price:  MOP$805.89
You save:  MOP$241.79
N$1,325.35
List Price:  N$1,893.44
You save:  N$568.09
C$2,576.69
List Price:  C$3,681.15
You save:  C$1,104.45
रु9,334.54
List Price:  रु13,335.63
You save:  रु4,001.09
S/259.58
List Price:  S/370.84
You save:  S/111.26
K267.89
List Price:  K382.72
You save:  K114.82
SAR262.49
List Price:  SAR375
You save:  SAR112.51
ZK1,765.85
List Price:  ZK2,522.76
You save:  ZK756.90
L322.98
List Price:  L461.43
You save:  L138.44
Kč1,645.46
List Price:  Kč2,350.75
You save:  Kč705.29
Ft25,709.21
List Price:  Ft36,729.02
You save:  Ft11,019.81
SEK kr749.87
List Price:  SEK kr1,071.30
You save:  SEK kr321.42
ARS$60,034.20
List Price:  ARS$85,766.82
You save:  ARS$25,732.62
Bs483.70
List Price:  Bs691.04
You save:  Bs207.33
COP$271,296.95
List Price:  COP$387,583.68
You save:  COP$116,286.73
₡35,581.11
List Price:  ₡50,832.34
You save:  ₡15,251.22
L1,728.07
List Price:  L2,468.78
You save:  L740.71
₲516,441.87
List Price:  ₲737,805.73
You save:  ₲221,363.85
$U2,647.22
List Price:  $U3,781.90
You save:  $U1,134.68
zł280.50
List Price:  zł400.73
You save:  zł120.23
Already have an account? Log In

Transcript

All right, so welcome back again. So in a previous tutorial, we saw a simple demo of the CLA that we are building for this particular project using commander j s. Now let's see how to build this particular CLA. So what we are doing is that we started from scratch. So just go back to my model five, where we are working, and I'm going to create a folder called cipher is the name of the package. Then I'll move inside my soft project and create a file called cipher.gs. Right?

Pivot, then let's initialize this particular project. This is going to be my npm init. to initialize project is going to give us some prompt for us to fill this prompt right, very interested to initiate that particular project. If so, was the nougat package, you just keep it a cipher that basically would be 0.01. Then a description is meant to be cipher. For in CLA, something like that, I don't know whether the word cipher is correct.

The entry point is going to be cipher Gs. Then we move on to the test of scent get upset, they can put inside cipher can just pass in your another key word, which can be any key word that you want it to be sounding like a SCI. Fi Farida if I can the other stuff right Deline uni, please, please put your name there. As you wish the new alliances can add your license to it by let's move without license for now. pivots, we are going to create it, just initialize it inside this particular project. Come back to the same place.

I have the same working directory. And I go with LS because I just created a packet dot JSON file, right? So this with this particular JSON file to be using to track our dependencies. So let's add dependencies going to be MPM install. Then we'll be using commander as our quote package, then we also use chalk to robots color and use Piglet to help us with our animation to not just go into save, to add it to our bucket gorgeous or as a part of our dependency for our development right? Less, which as I said data was stolen.

I just come back to my Sublime Text, start writing some code. So this is the police. So we have a file here, they have cipher GS and there's nothing here, right? If it if it's a while since installing, let's write some code. So the first thing that we're going to be important some stuff within the cost. Then when coders program, then how require my commander package like that is the big idea.

Then enlisting is going to be our choke is going to be cost, then called us choke to help us with our color. And our pass it to us choke. That utensil, then to work with Felicity is going to cost fake late then require in our passing my fake lit. And this order to be using right decided mean cooperative legibility but as we said, it is always recommended for you to structure your CLR. So let's structure our CLR. So first of all is going to be I This will be our cipher, that is the name of the CLR, then we come up to do rooted testing for a particular test, right?

There's going to be different stuff, then can we do cipher, then I can route it number by this by a particular number, right? So let's give it like a number. You know by lactating, right, that's another option for those who do. Then you can also do cipher for Caesar shift to see the shift or favor like this, right? Then can go with shift for that particular shift, right, something interested. Then they find out stuff all about one that you can use to reverse a string.

Going to be reverse, then artists, then we can also do some interesting stuff like gays also want to do lead conversion to cipher then leads then the test. So these are the main commands to be using and the basic usage of these are quads, right, we were keeping this one in mind whilst we do all these things. So I'll copy this then are saved in the developer tab paste here it as you can see, now let's work on it. So by now it has finished installing all the packages, everything has been installed figlio chore commander, everything has been added. Now let's work on it. So first of all good up the program is going to our program.

Then I'm just going to go with my vision. The vision is going to be version 0.01 as we stated in our package JSON, then I'm going to give it my description is going to be cipher, just simple. cipher. CLR I didn't know what I say for anything good English. Then in this is going to be the name of our package. So let's give this a name, which can leave it by default to pick this particular stuff right as the name is what we need right for me to avoid a single simple program.

Now, we need to pass it to the program dot pass and be the process dot arg v come in vector that is all. So with this simple code everything if I come back to my terminal, now go with node, then I go with cipher that says help. beautiful to see some basic information about this particular stuff that you are both very interesting. So let's say find out the name if you saw here, then you have a simple see a simple cipher in CLA, and then you have can see that we can work with division and then hope you notice that when we change the name to cipher here, they need a cipher right? That means that it's an arrow, so we should just correct it with this Now it's going to create studies the big idea behind this neat, so let's write again. Now it's going to work perfectly as expected and give us the required a cipher right.

Very interested, I can check for division. I'll give me division, just to print division 0.01 day that everything is perfect. Now let's see how to add the vehicle module. This one's pretty simple command to program with command. The first command is that you want to do routing, called test which route dating. That is the command attribute, right?

If it can do it, it's going to take a test, as we stated inside our documentation to help with it, testing, right, so that's what you have to do. Then I need to give it a description. Description you have to be taking tests dictating a test or a string. Then I can associate an alias which is going to How to write for that particular stuff. Oh, let's move on let's go to T shirt, t shirt, perfect the list add an action that actually is going to take a function actually takes a function that right right, then I can just move on and then pass in my test to the test I'm passing is referring to this particular test here, right? Then I can do whatever I want to do with it.

So first of all, let's print it out. So go to the console dot log, and I'm going to print it out as original test. Original artists then are passing that particular value, which is going to be our test. Here, right opposite Yes, my test. Very interesting. We can actually add some color to it.

So let's add your stroke to add some color to it. So let's call this blue. Go to mood. Enough passing my stuff. So that is cool. Oh, sweet.

Can I come back to my command prompt? I want to help. Perfect, I see that it's coming. Right. But I just wanted to release option to rotate. Rotating is good, I just hope it's working as expected, right.

Everything Is Working given us the right to competition. And I can pass the latest responsibilities like Hello, there is going to print the original test for us to read notice it's very interesting. Now we need to add a function to it. I so I've created a function, a simple JSON script that has all the views functionality built in to that script to be available so that you can actually use it to be in a particular script here. I'm just going to copy it up at the same location as my cipher, right. I'll come back to this place, then I'll paste it inside my sci fi location.

Right. Very interesting. activity. List check it I see. So, I just come back to my command prompt This is the cipher test to just check this particular test cipher test very interesting. And we have our rotating function here, you have another root function that takes a test in an a shift or a number, the new swab a Caesar shift very interested, then we can also have a notion of fitness drink, then delete conversion, the basic idea behind elite commission that you are taking the test is he replacing it with robots if it is be represented eight as as you wish, just like in case you are speaking leads, right?

Very interesting. Now, look, we did a session for a packet. So we say class is about this class, pass this test. Then we can apply all of these functions that we had on it right to race to do Caesar to do speech. leet speech right, very interesting, really supporting them. Sport in which dating routes, we teach self sida Then reverse string.

So let's delete and then a class itself, right? So it's gonna use it as a packet as well as a CLA. So I just come back see this and come back to my cipher text here that I need to import this to be a VA. I just think it's caused by let's make it a bar to cipher text in our require the name of the package dot backslash cipher. But yes, but yes, right with everything that is in this particular notice that because we are in the same location, they can be tricky to do to look for the current location and pick that particular file cipher.gs. That's what we need to be using it, we are exporting all of these things, all of these functions.

Right? And that will be important to us. I want to add a function to it, this number to this employees employees console. Let's put that over here results, then are passing that particular test is going to be my safer routes. tating which is not rotating, which is referring to this particular rotating here. From here, we'll either have this rotating version here.

So we are referring to that rotating function. And I'm going to pass in that particular value, which is going to be artists, right? Very interested in referring to this test. And then this test. If it then our console dot log is also going to console dot log. Now passing day, we did this through repeated test.

Then from here, I'll just use chalk dots, blue dot vote, passing, the result is going to be our results. If it's done so far, let's see this one. Let's go to that. Come back to our demo. You see right there. Let's run it again.

Run the same thing hope it doesn't give us any error. Perfect. So hello, has been treated to this misconception, right? protected three keys I run the same value the same value, this is going to give us the same result which is going to be you are Why Why be right? Give us Hello, right it must give us that it's working variable right we are going to rotate it, rotate it that's how to add that routed feature to it. Now let's see some other stuff to do.

I'm just going to go back to the simplicity of that and create another option so this is going to be another function copy the same thing that we have in our PCT so we have finished with the routing now we need to be to work on rotating a desk by a number no just by creating but any number right, which is just going to be like this. So now let's change this one from here to retreat, elitist. Now we are going to see routed test by a number right with this test by number two, we did this by a number that would be a description, pivot now when you have to sit back on a particular number Right. So the number be trying to make one. So I'll just come back to an apple is an added option. So before we add, let's add an Elias, for Kumar is going to be Lt.

Yes, there are the option for it. So an option is going to take my shirt format, you can make it in America make it shift, then the long format number, right, that's the basic idea. So we can even give a description to that particular option. So let's give a simple description is going to be see number two shitbag. So number two shift by or to get by with it by pivot that is a big ID, right? Perfect.

So now after passing up a club number here, so how do I do that? I can attach a number to it a value. So let's put that value and I'm just passing that particular value. Then I can receive all the different levels, whatever I'm going to be typing be attached this value, then I can pick it out. So I can just come back to the same place. Right?

That is a big idea. And then this particular option, so this, whatever we type in, today's number will be attached to this value that you can bring it out to this value. So let's add a special option here is going to be console. Let's look at my passing. That's my number, right to be number or TT number, I can just call it as a name going to be rotating number, then I pass it here is my let's go straight to the value. Total number, right that is what I need.

So let's change this function here. To use this particular function that you had to this would fit what it took inside this patch. We had some big changes to the function took a test in a shift right So that is the number we're using, there's going to be a test which we already have, then the number. So let's commit that one to number 10. value. Good number. Right?

So they're going to give us the result. So let's see this one. And let's come back to them. Now. Let's run it again, to come back to help, hopefully a bit and it's working well, so I wrote it out short format the option and I can run it like this. It does help it so I can just supply the number so I can just passing the test.

So let's call this Hello. As our number as our test, then the number this could be taking, let's see what is working. Perfect, right. So let's change it to 14 right to them that our weight function is working as expected. We are going to do two things, how to work with the rotating and how to rotate by a specific number. Very interesting.

Now let's see how to add the option of the Caesar shift. So this is just like you did tating. But we can also work on it to use either this name with it, or shift, or am I going to actually repeat the same thing. So I just come to the same place here, copy this, and then repeat it because the function is the same thing that you're just trying to give it another name. So I think if somebody's using an app and use the name, Caesar shift is to be able to work on it. So just change this one from here to Cedar shift then would call that see that shift shift co exploited seiza shifted this satellite that is, so we can you Welcome, CT to RT two Ts.

And I'm just going to change this one to shift, right. So this is going to be shift in a short format is going to be very interesting. So we're going to be seeing that number two shift by that is all right, the same thing we are doing, we are changing somebody's stuff. So here we will be coming back to this place in changes number two, shift. Then the same thing for this particular value here, which is going to be shift, right? Very interesting didn't come back to this function.

If we check from here, our function will see that we change it as much into C. Or Kaiser. They will call it three the big idea now, we know college with a number we call it shifting number. Shift number two, the same code But you're giving it a different name, save it. And then I'll come back here. Now let's go back to our help. Hopefully everything is working as expected.

So we have a shift. Now in case I want to run it the key district format, C is now passing my test. Hello. In our passing the number shipped by is we're going to be taking it wait what is given as an arrow because we have shifted, so it is supposed to be seiza. Right? Because that's what the function that we exported, which is here we are supported Caesar, Caesar shift, and then for Julius Caesar, right.

So this new function, that's why give us just come back to this place, and then recurrent again, while everything is working as expected, if I change the number to 15 it's working right. Very, very interesting. So we are going to see how to add sound Three main factors to it. Now let's see the next function of adding our reverse string and then speak of later, right. So it's going to be something very simple, I just come back to the same place, then run program program. Let's bring it to the top.

Come on, in, I pass it in reverse. There's a common name, then I just give it an unless you want to be out for reverse a string. Then I just come back in and give it my description. Description can be progress, test, or string. And I'll give you an option which is going to take a function which is going to be an anonymous function. So this is reversing a test.

I just bring my test here. Then I pass it here. He said this was an option, right? So there's going to be a test then Do the same thing that we have done above. So I just copy the same thing that we did copy this one here, do the same thing, do a little bit changing, changing this particular option, we are no more, bring it out, then from here, I'll just change it to my reverse reverse string. So we have our string function here, which is this particular function to reverse string.

That's what you're important. I'll come back to the same place, then run that particular string on it, then we'll reverse that particular test. That is what I really right. Perfect. So let's see it in less code as requests. Just see if I see it, and I come back to here.

Let's take for the help. Hopefully, there's no arrow. Very interesting. We have our requests, which are then I can just come back to my reverse. Now passing the word ABC to visit for CB pivot If everything is working as expected to the listing we need to work on is on our lit. So how do you reconcile it?

So I'll just come back to here we got to be exporting this speaker right I just come back to the same place, copy this entire stuff here because the same code then I repeated there are changes want to delete see our little latest then are passing my, my should format to is going to be let's convert it convert it as a string, right? Perfect. So I passed a test here inside this production to see more word then they committed the third fleet test. So what do we change in here that we change in our speak leet function to help us pick it here. purchase this particular function here. ppreciate important, right?

It's been putting up a bunch in there, you're using it to compete artists. So if I come back, and then I run it again, with the help of our leads, then I can now come back and run it with an example. So let's delete this delete. Hello. While everything is working as expected, so that's the big idea behind it. So we can also add another feature to it in which they basically give you a delete, then committed to the origin and destroy there's an article to do something very interesting, right?

So the only thing in between, all you have to do that are going to be replacing this was you change the direction right? You'll be changing the location ready to be the other way around. Identity basic idea behind this gives you also want to make it like that. So that we have to work on our leads our reverse our shift So you need to work on rotate, as well as our rotate fitting. So you're not sure the basic idea is that going to input all your required parties commander to help with our CLA choke to give us a color fit led to us and Piglet, then a cipher test to set forth this wizard as our test. We have all our basic functions, then exporting them here.

Then we are applying them individually inside our actions. Like that is a good idea. So let's work on Africa. So I just come back to the last occasion, this great program but come on, in our passing by the name of it, then we'll give it a description. Did you get to be info about CLR very interested in I actually didn't think of my function which didn't take any arguments. Can I just be seen whatever the note is this one Blow it up, they can just go straight away with our CLA with the console dot log.

They particularly Mozilla is going to be like Cypher satellite, I see I see this one, come back here. Let's take the help you have info, if I run the info. It's going to work and bring that Friday. So we have to make sure that you add Africa to this particular option. So how do we do that? So there are several ways of doing it to be used in a simplest format for our free glut which is going to be this particular option.

So just come back to this empty that we have. Right now. I'm using Fiddler to help us with that. So this is one of them just going to create console dot log in I'll use my Piglet variable, that test sink, right. So we think we'll be able to synchronize Test and bring it out. So let's go This one is my cipher.

So cipher, right? Something very basic, that's all. Then I'll just pass in a dictionary containing this towel that you want it to be a passing by point which is going to be a standard point. Committed cost if you want standard, then this option is going to be horizontal layout. You can also omit this one is going to break really the default. Then in this one is going to be vertical layout, which you will to use deadly force through vertical vertical layout is going to be our default.

If it does auto we need to not exclude this one. So I save this and I come back to here. Let's run it again. Hopefully is going to give us something perfect right to see that our sidebar is working as expected. Right. So good.

I also want to add some color to it. I can also add color to it as we learned earlier, which is awesome color to save artist. But let's not add a color here, but let's add a color to that as well he's going to go back to console. log in or passing some simple word right to the simple word, I'm passing this chalk sign then something very basic magical Yes, put your demo, do whatever you want to put. Let's give it something like Jesus saves at jakers Wright, this is something interesting, but it's pretty damn close. This one is working as expected.

Let's make it bold. And let's save it now. I come back here. I can run it again. run this again, you're going to see the tie sapphires, the entity sees Arctic Arctic. That is the basic idea about how to build a simple sea ally with Cypher.

Very, very interested. Right. Very, very cool. Very nice. We are going to see how to build a simple CLA with cipher. Very cool, right.

So since this is also a package can actually use the same package and use it to do a lot of things. Right. So that is something very cool. So in the next session, we'll try and see how to publish this as a package. Public, but glossy Li to get out of the package. So thank you for watching and see you in the next session.

But before we move on the big idea that just going to import your packages, you create your vision, then you create your individual programs, and then use your fashion to do this. Thank you for watching, and see you again, stay blessed.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.