#compose #file #default #template #touch

bin+lib cmps

cmps is short for compose, a tool used to create or fill files with a default content

11 releases

0.4.0 Feb 24, 2023
0.3.4 Oct 18, 2022
0.3.2 Jun 7, 2021
0.2.2 Jun 7, 2021
0.1.1 Nov 3, 2020

#633 in Filesystem

30 downloads per month


254 lines

Contains (Zip file, 455KB) templates/key, (Zip file, 135KB) templates/numbers, (Zip file, 84KB) templates/pages, (Zip file, 21KB) templates/pptx, (Zip file, 5KB) templates/docx, (Zip file, 12KB) templates/odp and 3 more.


An intelligent touch!

cmps is short for compose, an extendable cross-platform CLI tool to create or fill files with a default content.



          The filename to compose, may point to a non-existing file, or an empty existing file

          The extension to use, overrides the extension in the filename (if any)

      --show <extension>
          Show the template for this extension and the path to the source file

          Write the template for this file to stdout. Does not create or modify the file.

          Useful for integrating with editors like (Neo-)vim.

  -f, --force
          Overwrite existing files. This will clear the file contents if no template is found

  -v, --verbose...
          Sets the level of verbosity (provide multiple times for higher levels)

  -h, --help
          Print help information (use `-h` for a summary)

  -V, --version
          Print version information

Custom templates can be placed in your config directory (see https://docs.rs/dirs/latest/dirs/fn.config_dir.html for platform specific details) under cmps/templates. The name of the template file must match the file extension to be modified.

E.g. creating a file cmps/templates/py with the contents

#!/usr/bin/env python3
# Author: John Doe

will insert the shebang and the author name when creating python files with compose.

Local (per-project) configuration

If you want to use different templates for a specific project, you can create a .cmps directory to add additional templates or overwrite existing ones. A good use-case for this is if you want to automatically insert a specific license in one of your projects, but not everywhere.

Like in the config directory, templates must be placed under a templates subfolder in this .cmps directory.

E.g.: /my/important/project/.cmps/templates/py would overwrite the template used for python files in the /my/important/project/ directory and its subdirectories.


Björn Daase and Leon Matthes


~43K SLoC