Building CLI Tools with Fire.jl

Building Command Line Tools with Python, Julia and Nodejs Module 04 - Building Command Line Tools in Julia
13 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
€59.67
List Price:  €85.25
You save:  €25.57
£51.54
List Price:  £73.64
You save:  £22.09
CA$95.57
List Price:  CA$136.54
You save:  CA$40.96
A$107.02
List Price:  A$152.90
You save:  A$45.87
S$89.48
List Price:  S$127.84
You save:  S$38.35
HK$549.41
List Price:  HK$784.91
You save:  HK$235.49
CHF 55.82
List Price:  CHF 79.75
You save:  CHF 23.92
NOK kr705.59
List Price:  NOK kr1,008.04
You save:  NOK kr302.44
DKK kr445.23
List Price:  DKK kr636.07
You save:  DKK kr190.84
NZ$116.40
List Price:  NZ$166.30
You save:  NZ$49.89
د.إ257.07
List Price:  د.إ367.26
You save:  د.إ110.19
৳8,547.65
List Price:  ৳12,211.45
You save:  ৳3,663.80
₹5,998.73
List Price:  ₹8,569.99
You save:  ₹2,571.25
RM296.82
List Price:  RM424.05
You save:  RM127.23
₦107,067.90
List Price:  ₦152,960.70
You save:  ₦45,892.80
₨19,857.50
List Price:  ₨28,369.07
You save:  ₨8,511.57
฿2,275.82
List Price:  ฿3,251.32
You save:  ฿975.49
₺2,801.25
List Price:  ₺4,001.95
You save:  ₺1,200.70
B$384.16
List Price:  B$548.83
You save:  B$164.66
R1,244.40
List Price:  R1,777.80
You save:  R533.39
Лв116.53
List Price:  Лв166.48
You save:  Лв49.95
₩95,890.94
List Price:  ₩136,992.93
You save:  ₩41,101.99
₪234.82
List Price:  ₪335.48
You save:  ₪100.65
₱3,948.41
List Price:  ₱5,640.83
You save:  ₱1,692.42
¥10,246.95
List Price:  ¥14,639.13
You save:  ¥4,392.17
MX$1,304.26
List Price:  MX$1,863.31
You save:  MX$559.04
QR255.49
List Price:  QR365.01
You save:  QR109.51
P932.47
List Price:  P1,332.16
You save:  P399.68
KSh9,042.70
List Price:  KSh12,918.70
You save:  KSh3,876
E£3,477.25
List Price:  E£4,967.72
You save:  E£1,490.46
ብር9,699.65
List Price:  ብር13,857.24
You save:  ብር4,157.58
Kz63,827.73
List Price:  Kz91,186.38
You save:  Kz27,358.65
CLP$65,891.38
List Price:  CLP$94,134.58
You save:  CLP$28,243.20
CN¥502.10
List Price:  CN¥717.32
You save:  CN¥215.22
RD$4,182.92
List Price:  RD$5,975.86
You save:  RD$1,792.93
DA9,070.15
List Price:  DA12,957.92
You save:  DA3,887.76
FJ$157.14
List Price:  FJ$224.49
You save:  FJ$67.35
Q538.08
List Price:  Q768.73
You save:  Q230.64
GY$14,645.08
List Price:  GY$20,922.44
You save:  GY$6,277.35
ISK kr8,509.38
List Price:  ISK kr12,156.78
You save:  ISK kr3,647.40
DH629.09
List Price:  DH898.74
You save:  DH269.65
L1,181.87
List Price:  L1,688.45
You save:  L506.58
ден3,668.77
List Price:  ден5,241.33
You save:  ден1,572.55
MOP$566
List Price:  MOP$808.61
You save:  MOP$242.60
N$1,240.94
List Price:  N$1,772.85
You save:  N$531.90
C$2,572.08
List Price:  C$3,674.55
You save:  C$1,102.47
रु9,599.75
List Price:  रु13,714.52
You save:  रु4,114.76
S/248
List Price:  S/354.30
You save:  S/106.30
K293.02
List Price:  K418.62
You save:  K125.60
SAR262.49
List Price:  SAR375.01
You save:  SAR112.51
ZK1,695.71
List Price:  ZK2,422.54
You save:  ZK726.83
L302.41
List Price:  L432.04
You save:  L129.62
Kč1,470.76
List Price:  Kč2,101.18
You save:  Kč630.41
Ft23,833.05
List Price:  Ft34,048.67
You save:  Ft10,215.62
SEK kr665.85
List Price:  SEK kr951.26
You save:  SEK kr285.40
ARS$88,327.76
List Price:  ARS$126,187.92
You save:  ARS$37,860.16
Bs483.71
List Price:  Bs691.04
You save:  Bs207.33
COP$279,416.32
List Price:  COP$399,183.29
You save:  COP$119,766.96
₡35,353.26
List Price:  ₡50,506.82
You save:  ₡15,153.56
L1,825.97
List Price:  L2,608.64
You save:  L782.67
₲557,854.51
List Price:  ₲796,969.17
You save:  ₲239,114.66
$U2,810.15
List Price:  $U4,014.67
You save:  $U1,204.52
zł253.24
List Price:  zł361.79
You save:  zł108.54
Already have an account? Log In

Transcript

All right, so welcome back again to module four. So in this session of the course, we try to see how to build our own ci tools in Julia. Julia is a very nice programming language that allows you to be able to do some cool stuff. So it is quite easy to learn very fast like C and easy to learn like Python, right. So that's what we tried to see how to build your own custom tools in Giulia so there are several packages that can help us to be able to do the right tools. So among them include a path just like the normal Python path used to have fire jail, which is one of my favorite they also have to deadlocked and then they pass a solid hour just like parts of the job and packages that you can actually use in Julia.

Now let's see how to build our own custom ci tools in Julia in this session. Alright, so in case you have not installed Julia, just go to the official website Julia language org. Then you can just download it for your system fully supports several major steps for Macintosh for Windows for Linus and server. Have them as you wish, can just click on it, can you store it, there's something very basic, unless you have to work with it. So I just wanted me to be trying to see how to build our own custom till I choose, I'm just going to set up my place and then you get started. So we are working inside our Moodle folder here, which is nothing but only the base x, right.

So let's see what I mean. So first of all work with fire phases are very nice to that you have learned previously in Python, a Python session. So in today's session, we can do the same thing. Let's see how to upgrade it to be added. So I'll just open my Julia repo then we'll be able to add our package to it. Right, very interesting.

So to add a package to your Julia option. repo, there's two main ways you can just go into the using package pkg then you will be able to add your package by going to pkg dot add. Then you pass in your packet. It is a faced method of working or adding your own I get into that, right? Very interesting. Now let's move on to the next to the next method is just to go today.

All right, this, this particular one here, this stuff is in here, right? This stuff here, we click on it on your keyboard is automatically going to switch to your package mode, right, which is a blue one. Then from here, you can just go with ADD, and fire, to add it to we added fire to our package repository. Then we have to see how to work with it to positive other let's see how to recreate it. I'm going to create a simple file, which is going to be called our basics Eli. As you have been doing basic CLR dot jail, right the extension might be jail because we are working with Julia.

So let's see how to work with assemblies. So let's say I've created something very simple, simple function that does something like register. What does it really say? It's registered people based on their face, right? to their mouth. And then I want to print that particular thing.

So hello independently right to continue with this particular format of the first name. Or that is one way of doing it in this way. So let's say you want to run this particular function, right? How do you do that to the simplest we'll just come back to your terminal. Let me open another one so you can see how to work with it. So what is going to run this particular function, I just have to come back in and call it like, usual function then supply the name as Jesse Jones, right.

So we are registering Jones. So to print it out. I'll just come back to my terminal. As always, in every programming language, then you start with the name of the programming language, which is going to be the preta, then your fashion or your thought, right? That is the basic idea about how to work with it. So it's going to be Julia Dyneema basic CLA and it's going to print it for us.

Or Hello, Joyce right? Very, very interesting. Hello choice. That is how to work with it. So give I want to make changes to really set it up. It's not to change the name from here and then give it to like listen, James, James Jefferson did it save it didn't have to run it again.

Before to give me James names if I were to convert this one into a simple sealer. So how do I do that? So the simplest way is to use fire right to condense go back to fire or to input it to buy now that's finished installing fire store, updating it that's already stored, it can just come back to you. top of your file. Good evening. Fire just getting fire That is all that you need to be able to build a simple CLR right to convert your functions your struct into something very cool in Julia, so I just pass in here with my, my macro in Julia, this is not a decorator, right?

This is a macro, I just put in the estimate. You've heard of any function. Once I put this at many different functions, it exposes that particular function as a CLA, right, so it's gonna be a big deal. So just think of this. I'll save it. And I'll come back to my demo.

Then I now run it like a sea lion. Welcome back to this video, I agreed to help with the help documentation to it because of this simple import in a file, and then the main file that I've been placing in front of my function. So it is a simple stuff that's given to us through now that there's no documentation because we don't give any documentation for our function, then the name of the function which is register, and then some previous information about the location of our far right, as well as the line. And then the position argument which is very famously very interesting. So that is how to build a simple ci with fire commit any function to to see Li using fire. Now let's run after class stuff to to run it can just come back straightaway to displace.

And then I can just pass in the name. So let's keep it in like James there who was Michael identified this James and print it out for us, right? Because that's the only function that we have the perfect Susilo can have our Hello James there, right, that's printed perfectly well. So that is one way of working with fire and getting our documentation to just come up to the top of it. Are you committed? Let's go just register.

Register user right So if I come back and I run the same thing that we did previously for the help now, because I've added this documentation to it now this is going to be part of the documentation to come back to my terminal, and then run the help. So now that's given us our documentation, right is a dose drink, and engineer, we put our documentation while dose drink on top of the function, right? So you're given to us when you say user in a position argument is good. But in case I want to actually specify half server functions, we can call the function itself right instead of just calling the position. So let's see how to work with it. So come back to this.

The lesson under function of this function is going to be something differently sort of register and it's going to just say, it's going to preach the person by the first name. Then good to go it and then there's another way of printing out something I just go into print or go into print like to the printer. I'm going to leave this piece consider hold these these days no space left between, yes, this is the ally as well as the result, right. But in case you want to leave a space, the next slide go to print and leave a space. That is why we use a printer. So if I just come back to the same thing that we did, let's say good morning in our passing day, faithfully is another way of doing it right.

I see it now and I come back to add my, my macro for the me I can have two different functions. So if I run the help again, as want to give us Nadia, the Krishna admin stuff, it was give us the two main functions that we have, right. So they fire for register, a function for greet, which there are no you have our register function, not greet function. Very, very interesting, because I want to see the help for that particular stuff. I just come back to the same thing. And let's apply that register.

Would register to be re justa. Going to print that particular usage for us not the interest, but only for the register function or the register command. It's something very simple, something very basic. That is the basic idea behind it. So with file, you can convert any function into a useful CLR. So let's add some more documentation as to this case, is going to be for a good user.

And now let's do some interesting stuff. So we're just going to create a user and convert that into let's see, reversing the patient's name, right, something cool. So the role stuff, so one, and then I'm going to be revising the patient's name with this particular option. So we'll come back to displace clay off everything. Now you can actually break check what they hope will give us information about the hope and then DPS documentation for each and every one of the hopes Perfect. So let's work with the greet function.

So I can call that greet function actually, is going to only pick that particular good function and give me the result. So greet, then I can supply the name to the name I'm supplying is Josh or john right? It's going to print perfectly for us in a reverse order because we are reversing the face name question here, with this particular option, said, Good morning, john. Very interestingly, how to leave a space in between. Right again, which is now going to be replaced. Perfect.

So now we have this piece here, or this piece left behind here. And then we have our john if I run the first one, the one without space, and let's make that one register. With that, there's not going to be register. Because it's going to just print as we know, Julia, this print is going to go without a space but this is going to bring the speed that in different immune defense. You like you see a lot of features, sort of difference. So this data speed is expensive.

And it's hard to build a simple CLA, if it turns out to work with it. So let's see some other stuff you can also do, you can also restrict this particular stuff and give you this particular type right by giving me this option of less abstract. String. You don't get as we did. So this is a given there's no by it's not. By force commit, it's not it's not mandatory, you can omit it Angela automatically identify your type, but this is how to set a particular type to your function.

Right. Very interesting. Let's add another one to salary is going to be let's see. So, salary for the person, then we just create another function. main function is going to be at salary. Passing numbers right.

The numbers Because then are passing the integer going to see volunteers all integers. Pivot then I can keep it as a split to see multiple entities, right? Not only just one, and I'll come back to this place and print line to add in this not passing that particular value pretty good. Let's sum it up to print line. Awesome. So no matter no matter how much I'm given is going to print it.

Let's see if this one. Let's come back to our fingers hope to keep us our register greet at salary to read our salary. I can add some values to add. Let's go salary, a passing a particular value. So let's get 22 It is good art. So no matter the amount of volume which is supplied, it should keep on accepting them and giving them the value for us in a PowerPoint.

So if I go back to this 50 is still going to work perfectly for us. So that is the basic idea behind how to work with Julia. Very interesting. So in a nutshell the big idea that's just going to use fire, then you quit your individual functions right? And get used to it the documentation then to expose or convert your function into SLI. Yes, bring the admin the admin or the main macro.

That is all that you need to do to pour this Eli with two. Thank you for watching and see you the next session. 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.