Having completed the setup, we start using Chestnut for the first time. You can download your first targzipped package from here. Once you obtain the file, you have to unpack it in one of the package directories specified during the setup, for example
tar -xzv -C $HOME/Packages/ -f hello-1.0.0.package.tar.gz
As you can see from the extraction, the package is a simple directory. We will ignore what is inside this directory for now. With this command, you just deployed your first package. You can take a final look at the package by using the command cnls. This command displays a list of the available packages.
$ cnls hello-1.0.0
You can get a little more information about what the program does by using the -d switch
$ cnls -d hello-1.0.0 : Prints a salutation message
Or, if you are really curious, you can get even more information by using the -l switch
$ cnls -l
hello-1.0.0:
Description: Prints a salutation message
Flags: xd
Location: /Users/stefano/Packages/hello-1.0.0.package
Executable entry points:
hello (default) : Prints hello!
Time for some action. The cnrun program allows you to execute the hello package for the very first time
$ cnrun hello-1.0.0 hello!
Now, let’s try to move the hello package into another Package repository, for example in /opt/Packages.
$ mv $HOME/Packages/hello-1.0.0.package /opt/Packages/ $ cnrun hello-1.0.0 hello!
As you can see, everything works as before, but if you try to invoke cnls, this time will tell you a different story about the location of the package
$ cnls -l
hello-1.0.0:
Description: Prints a salutation message
Flags: xd
Location: /opt/Packages/hello-1.0.0.package
Executable entry points:
hello (default) : Prints hello!
The package is now in another directory. We are not concerned about where the package is located when invoking cnrun. We are only concerned about the name (and version) of the package we want to invoke. In this sense, Chestnut acts in a similar way to the shell PATH variable: PATH removes the burden of knowing the absolute location of an executable on the filesystem. Chestnut removes the burden of knowing the absolute location of a package on the filesystem. Both require you to define “magic directories” where their mechanism is actuated.

Leave a Reply