Clk Provides a Bunch of Everyday Usage Lib
Fleetingclk provides a bunch of everyday usage lib
When creating a command, you generally want the same stuff again and again.
Those are commands to manipulate files, run programs and capture the output, format tables in the output etc.
For instance, take a look at this command, to download some dependencies to work with k8s.
@k8s.command()
def install_dependencies():
"""Install the dependencies needed to setup the stack"""
call(['sudo', 'apt', 'install', 'libnss-myhostname', 'docker.io'])
download(k3d_url, outdir=bindir, outfilename="k3d", mode=0o755)
with tempdir() as d:
extract(helm_url, d)
move(Path(d) / "linux-amd64" / "helm", bindir / "helm")
(bindir / "helm").chmod(0o755)
with tempdir() as d:
extract(tilt_url, d)
move(Path(d) / "tilt", bindir / "tilt")
download(kubectl_url, outdir=bindir, outfilename="kubectl", mode=0o755)
This command created temporary directories to download some content, extracted the content, called some program without using the standard library, a little bit to low level.
The program is very easy to write and read.