cnote is a useful tool that can help you manage your C codes.
clean: Recursively removes//comments and appliesclang-formatto C source files.doc: Generates a multi-page, navigable Markdown documentation site from/** @brief ... */style comments in source files.license: Applies or updates a license header to all source files, skipping files that already have it.
To build cnote from source, you will need:
clang(fluf depends on some features that only clang support)makegit(to clone the repository and its submodules)
To use cnote, you must have the following tools installed and available in your system's PATH:
clang-format: Required by thecleancommand.
NOTE: most of the times, if you installed
clang, you will get clang-format on your system
cnote uses a git submodule for its core library (fluf).
-
Clone the repository:
git clone https://github.com/Karesis/cnote.git cd cnote -
Initialize and update the submodule:
git submodule update --init --recursive
-
Build the project:
make
-
Install the binary (optional): This will install
cnoteto/usr/local/bin(or a customPREFIX).sudo make install
To uninstall:
sudo make uninstall
To update:
# update files make update # then install sudo make install
cnote is a command-line tool. You can get help at any time:
$ cnote --help
Usage: cnote <command> [options] [targets...]
Commands:
clean [opts] <paths...> Removes '//' comments and runs clang-format.
doc <src_dir> <out_dir> Generates markdown documentation (mdBook compatible).
license [opts] <paths...> Applies or maintains a license header.
General Options:
-h, --help Show this help message.
'clean' Options:
-e, --exclude <path> Exclude a file/directory.
-s, --style <file> Path to .clang-format file to use.
'license' Options:
-e, --exclude <path> Exclude a file/directory.
-f, --file <license_file> (Required) Path to the license text file.Clean all .c and .h files in the src and include directories, excluding the vendor directory:
cnote clean -e vendor/ src/ include/Use a specific .clang-format file:
cnote clean -s ./.clang-format src/Generate documentation from all sources in src/ and include/ and write the site to the docs/ directory:
# cnote doc <source-directory> <output-directory>
cnote doc include docs/referenceAfter running, this will create a structure like this:
docs/
└──reference/
├── SUMMARY.md (The main table of contents)
└── api/
├── include_clean_h.md
├── include_doc_h.md
├── src_main_c.md
└── ...etc
Apply the license header from LICENSE_HEADER to all files in src/ and include/:
cnote license -f LICENSE_HEADER src/ include/For information on the internal C API (e.g., for contributing to cnote), see the generated api entry API Entry.
This project is licensed under the Apache-2.0 License. See the LICENSE file for details.