CLICK - Working with Pass Context

Building Command Line Tools with Python, Julia and Nodejs Module 02 - Building Command Line Tools in Python with CLICK
6 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.63
List Price:  €85.20
You save:  €25.56
£51.67
List Price:  £73.82
You save:  £22.14
CA$95.06
List Price:  CA$135.81
You save:  CA$40.74
A$106.25
List Price:  A$151.80
You save:  A$45.54
S$89.42
List Price:  S$127.75
You save:  S$38.32
HK$549.41
List Price:  HK$784.91
You save:  HK$235.49
CHF 55.47
List Price:  CHF 79.24
You save:  CHF 23.77
NOK kr704.31
List Price:  NOK kr1,006.20
You save:  NOK kr301.89
DKK kr445.14
List Price:  DKK kr635.95
You save:  DKK kr190.80
NZ$115.91
List Price:  NZ$165.59
You save:  NZ$49.68
د.إ257.07
List Price:  د.إ367.26
You save:  د.إ110.19
৳8,488.34
List Price:  ৳12,126.72
You save:  ৳3,638.38
₹6,047.68
List Price:  ₹8,639.92
You save:  ₹2,592.23
RM295.88
List Price:  RM422.70
You save:  RM126.82
₦106,816.63
List Price:  ₦152,601.73
You save:  ₦45,785.10
₨19,869.70
List Price:  ₨28,386.51
You save:  ₨8,516.80
฿2,250.66
List Price:  ฿3,215.37
You save:  ฿964.71
₺2,831.38
List Price:  ₺4,045.01
You save:  ₺1,213.62
B$389.64
List Price:  B$556.66
You save:  B$167.01
R1,225.99
List Price:  R1,751.49
You save:  R525.50
Лв116.64
List Price:  Лв166.63
You save:  Лв49.99
₩96,455.89
List Price:  ₩137,800.04
You save:  ₩41,344.14
₪232.96
List Price:  ₪332.81
You save:  ₪99.85
₱3,978.73
List Price:  ₱5,684.14
You save:  ₱1,705.41
¥10,253.91
List Price:  ¥14,649.08
You save:  ¥4,395.16
MX$1,305.22
List Price:  MX$1,864.69
You save:  MX$559.46
QR254.19
List Price:  QR363.15
You save:  QR108.95
P971.95
List Price:  P1,388.55
You save:  P416.60
KSh9,039.20
List Price:  KSh12,913.70
You save:  KSh3,874.50
E£3,435.80
List Price:  E£4,908.50
You save:  E£1,472.70
ብር9,672.74
List Price:  ብር13,818.79
You save:  ብር4,146.05
Kz63,827.73
List Price:  Kz91,186.39
You save:  Kz27,358.65
CLP$66,560.49
List Price:  CLP$95,090.49
You save:  CLP$28,530
CN¥501.27
List Price:  CN¥716.13
You save:  CN¥214.86
RD$4,208.48
List Price:  RD$6,012.38
You save:  RD$1,803.89
DA9,075.55
List Price:  DA12,965.63
You save:  DA3,890.08
FJ$156.72
List Price:  FJ$223.89
You save:  FJ$67.17
Q535.08
List Price:  Q764.44
You save:  Q229.35
GY$14,586.35
List Price:  GY$20,838.53
You save:  GY$6,252.18
ISK kr8,492.58
List Price:  ISK kr12,132.78
You save:  ISK kr3,640.20
DH628.13
List Price:  DH897.37
You save:  DH269.23
L1,183.46
List Price:  L1,690.74
You save:  L507.27
ден3,667.73
List Price:  ден5,239.85
You save:  ден1,572.11
MOP$563.73
List Price:  MOP$805.37
You save:  MOP$241.63
N$1,227.38
List Price:  N$1,753.48
You save:  N$526.09
C$2,565.67
List Price:  C$3,665.40
You save:  C$1,099.73
रु9,633.57
List Price:  रु13,762.83
You save:  रु4,129.26
S/248.25
List Price:  S/354.66
You save:  S/106.40
K293.09
List Price:  K418.72
You save:  K125.62
SAR262.57
List Price:  SAR375.12
You save:  SAR112.54
ZK1,612.42
List Price:  ZK2,303.55
You save:  ZK691.13
L302.32
List Price:  L431.90
You save:  L129.58
Kč1,468.25
List Price:  Kč2,097.59
You save:  Kč629.34
Ft23,805.78
List Price:  Ft34,009.72
You save:  Ft10,203.93
SEK kr664.37
List Price:  SEK kr949.15
You save:  SEK kr284.77
ARS$87,869.07
List Price:  ARS$125,532.63
You save:  ARS$37,663.55
Bs481.76
List Price:  Bs688.26
You save:  Bs206.49
COP$282,226.47
List Price:  COP$403,197.96
You save:  COP$120,971.48
₡35,167.05
List Price:  ₡50,240.80
You save:  ₡15,073.74
L1,824.86
List Price:  L2,607.06
You save:  L782.19
₲530,242.01
List Price:  ₲757,521.05
You save:  ₲227,279.04
$U2,813.53
List Price:  $U4,019.51
You save:  $U1,205.97
zł253.63
List Price:  zł362.35
You save:  zł108.71
Already have an account? Log In

Transcript

All right, so welcome back again. So in this particular session of the course, we try to see how to work with chaining of commands, right. So in a previous tutorial, we saw how to work with click dot group to be able to create a period command to create child commands. Now let's see how to chain commands together. So what do I mean by chaining comma, so for example, if I go back to Python, three in our group to see Li, then I go with my reverse name. I can revisit it, but what if I want to not only just reverse it, but also capitalize it?

Capitalize it together. So how do I do that? So we can use the chain option to do so let's go with chain you put in top of the group is equal to true, right? Perfect, who's going to link them together? And now let's make some changes. I'm just going to take off this and then we'll take off this particular test here.

Right. I want to show you something before we move on today. I spit from here, I guess make it like, reverse war. code, I'd come back to this place. Let's see. So with this option, now I can run the same stuff here.

Instead, reverse was caught is shown here. And then Jesse was also showing it can work separately without any artist. Previous was code, considered the same thing for the capitalized clothing are separated by two cars to chain them together. Right? Very, very interesting, very brief, but these are the best. So we won't be able to make sure that we have to pass in a value from one command to the other common.

So how do we proceed once Polly from our command together, so let's see. So the simplest way you guys can just come to this place to the main group here. Then you use the Add click to pass contest, right to read the article in the past contest view to receive and store the value and then pass it on to the next one. So let's add some name here. Some value here. So let's Call it us click that option then be using leave right to be changing the name, they will be passing the name to the next option.

Then from here I just move it CTS for contest, then the new option that I'm storing, very simple. The listicle of this pseudonymous data, which is going to ensure that our city object is a dictionary, right? So we'll be storing the value inside the dictionary. So it's going to be contests that show complete. addition to the big ideas, we actually had, that object is going to be a dictionary, which will be storing your stuff. So it is with this dictionary, we call it a disorder we need right.

So I thought that you're just going to come back down here. Then specify that object contest that object OBJ for object. Then we specify the name we are receiving Which is very in tune is particularly nice, we will be storing every test, we get to have many objects at help at least have each p also do what I want for this. So let's try the simplest one. To me. Now I can be able to pass the list fairly, I'm getting from this to this command line to the next command.

So how do we do is come back to this place, and oh, we need to just call click dot pass contest that is all in reading would supply that particular option where this particular option is going to work perfectly. They're going to pass in your CTS, which is going to inherit it from here, right. Now we can actually do our best to do the reverse can actually come back to this option. Let's go to sleep. Right and then from here, continue with our C contest object which is referring to the Navy to be picking it from that particular place, right. So let's go that's a new name search.

Differentiated forms response when you need to go in to change it to format new name and this one right to replace it with something which we are typically that you see with the new form here. We are storing it inside this traditionary and we are passing that dictionary into our address option. There is also do the same thing for our Agnes allistic it off, take this one off and repeat the same thing with a click pass on something very simple. And then we can just pass in our contest here so as to inherit it from there. Then we will do the same thing we did at the top. actually do say this.

Could this could have it then you pass in Donnie The top right is still going to work. So let's save it now let's see where to come back to help. So, perfect. So, we have our leave at option you can pass it over. So, I can just come back to this place I have did we have our this see we cannot how we can do we have option How come on come on. So I can just come back to this place and then go into the seat name just right then I can just move on to the next command have capitalized for this.

Then cup they agree this is going to call the two of them definitely. So it was able to phase four, reverse it and then capitalize it very interested. So I can hopefully do it for you one is also going to make it so that is a very useful way of chaining commands together and then pass in a contest for the value from one command to the other can even change the range From this option to color space, let me expand it so that you can see to capitalize, then reverse is still going to do the same thing, no matter how you do it, right. It's very, very useful and very, very essential. So this is how to pass contest and how to chain groups of command together. Thank you for watching for the big idea that you just set it to true.

You use the past contest, you hear it this particular point S which is going to ensure that the dictionary, then you pass it for the various sub commands or the previous command that you be using in your car. Thank you if you need a 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.