KPM is a command line tool which modularizes the process of generating text files. It was initially developed to generate configuration files for Kubernetes as a more robust alternative to Helm Charts, however it can be used in any situation that requires text file generation.
KPM uses the concept of "template packages" to generate files. A template package is simply a collection of individual text file templates. This collection of templates can be thought of as a program which can be executed. A template package accepts inputs in the form of parameters, and produces outputs in the form of generated files.
See the docs for more information about how to use template packages and author your own template packages. There are also examples that you can use as a starting point for authoring your own template packages.
First, choose and remember the appropriate operating system string, ${os}
, for your system:
darwin
linux
windows
Also, choose and remember the appropriate architecture string, ${arch}
, for your system:
amd64
arm64
386
These values will be used to install the appropriate binary.
Download the KPM executable from the Releases tab. Put this executable somewhere on your PATH so it is available from anywhere on your machine.
If ~/bin
is not already on your PATH, add it:
export PATH="$PATH:~/bin"
To make this permanent, add it to your ~/.bashrc
file:
echo "export PATH=\"\$PATH:~/bin\"" >> ~/.bashrc
Note that the file needs to be made executable after download.
wget -O ~/bin/kpm "https://github.com/rohitramu/kpm/releases/latest/download/kpm_${os}_${arch}"
chmod 777 ~/bin/kpm
For example, if os=linux
and arch=amd64
:
wget -O ~/bin/kpm "https://github.com/rohitramu/kpm/releases/latest/download/kpm_linux_amd64"
chmod 777 ~/bin/kpm
Invoke-WebRequest -OutFile "${Env:ProgramFiles}/kpm.exe" "https://github.com/rohitramu/kpm/releases/latest/download/kpm_${os}_${arch}.exe"
For example, if os=windows
and arch=amd64
:
Invoke-WebRequest -OutFile "${Env:ProgramFiles}/kpm.exe" "https://github.com/rohitramu/kpm/releases/latest/download/kpm_windows_amd64.exe"
To see the list of available subcommands:
kpm -h
To see the usage pattern for any subcommand, use the -h
flag:
kpm new -h
To get the version information for the KPM binary, run:
kpm version