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
€67.35
List Price:  €96.21
You save:  €28.86
£55.83
List Price:  £79.77
You save:  £23.93
CA$100.76
List Price:  CA$143.95
You save:  CA$43.19
A$112.23
List Price:  A$160.33
You save:  A$48.10
S$95.14
List Price:  S$135.93
You save:  S$40.78
HK$543.62
List Price:  HK$776.63
You save:  HK$233.01
CHF 63.04
List Price:  CHF 90.06
You save:  CHF 27.02
NOK kr797.48
List Price:  NOK kr1,139.30
You save:  NOK kr341.82
DKK kr502.49
List Price:  DKK kr717.87
You save:  DKK kr215.38
NZ$124.10
List Price:  NZ$177.29
You save:  NZ$53.19
د.إ257.07
List Price:  د.إ367.26
You save:  د.إ110.18
৳8,361.55
List Price:  ৳11,945.58
You save:  ৳3,584.03
₹5,962.79
List Price:  ₹8,518.63
You save:  ₹2,555.84
RM314.04
List Price:  RM448.65
You save:  RM134.61
₦108,335.42
List Price:  ₦154,771.52
You save:  ₦46,436.10
₨19,495.71
List Price:  ₨27,852.21
You save:  ₨8,356.49
฿2,390.81
List Price:  ฿3,415.60
You save:  ฿1,024.78
₺2,467.44
List Price:  ₺3,525.07
You save:  ₺1,057.62
B$434.14
List Price:  B$620.23
You save:  B$186.09
R1,296.68
List Price:  R1,852.48
You save:  R555.80
Лв131.68
List Price:  Лв188.12
You save:  Лв56.44
₩102,198.93
List Price:  ₩146,004.73
You save:  ₩43,805.79
₪256.56
List Price:  ₪366.53
You save:  ₪109.97
₱4,090.81
List Price:  ₱5,844.26
You save:  ₱1,753.45
¥10,994.99
List Price:  ¥15,707.80
You save:  ¥4,712.81
MX$1,408.98
List Price:  MX$2,012.91
You save:  MX$603.93
QR255.09
List Price:  QR364.43
You save:  QR109.34
P967.82
List Price:  P1,382.66
You save:  P414.84
KSh9,046.20
List Price:  KSh12,923.70
You save:  KSh3,877.50
E£3,562.49
List Price:  E£5,089.49
You save:  E£1,527
ብር8,907.19
List Price:  ብር12,725.10
You save:  ብር3,817.91
Kz63,830.88
List Price:  Kz91,190.88
You save:  Kz27,360
CLP$69,323.69
List Price:  CLP$99,038.09
You save:  CLP$29,714.40
CN¥510.80
List Price:  CN¥729.75
You save:  CN¥218.94
RD$4,245.36
List Price:  RD$6,065.06
You save:  RD$1,819.70
DA9,465.07
List Price:  DA13,522.10
You save:  DA4,057.03
FJ$162.39
List Price:  FJ$232
You save:  FJ$69.60
Q539.11
List Price:  Q770.19
You save:  Q231.08
GY$14,638.77
List Price:  GY$20,913.42
You save:  GY$6,274.65
ISK kr9,772.70
List Price:  ISK kr13,961.60
You save:  ISK kr4,188.90
DH703.98
List Price:  DH1,005.73
You save:  DH301.75
L1,291.33
List Price:  L1,844.84
You save:  L553.50
ден4,143.97
List Price:  ден5,920.21
You save:  ден1,776.24
MOP$559.97
List Price:  MOP$800
You save:  MOP$240.02
N$1,289.45
List Price:  N$1,842.15
You save:  N$552.70
C$2,574.80
List Price:  C$3,678.44
You save:  C$1,103.64
रु9,534.71
List Price:  रु13,621.60
You save:  रु4,086.89
S/260.99
List Price:  S/372.86
You save:  S/111.86
K283.85
List Price:  K405.52
You save:  K121.66
SAR262.91
List Price:  SAR375.60
You save:  SAR112.69
ZK1,936.45
List Price:  ZK2,766.47
You save:  ZK830.02
L335.12
List Price:  L478.77
You save:  L143.64
Kč1,694.03
List Price:  Kč2,420.15
You save:  Kč726.12
Ft27,771.44
List Price:  Ft39,675.18
You save:  Ft11,903.74
SEK kr774.38
List Price:  SEK kr1,106.30
You save:  SEK kr331.92
ARS$71,792.58
List Price:  ARS$102,565.23
You save:  ARS$30,772.64
Bs484.55
List Price:  Bs692.24
You save:  Bs207.69
COP$307,165.41
List Price:  COP$438,826.54
You save:  COP$131,661.12
₡35,530.54
List Price:  ₡50,760.09
You save:  ₡15,229.55
L1,777.33
List Price:  L2,539.15
You save:  L761.82
₲546,250
List Price:  ₲780,390.60
You save:  ₲234,140.59
$U3,115.91
List Price:  $U4,451.49
You save:  $U1,335.58
zł287.82
List Price:  zł411.19
You save:  zł123.37
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.