Skip to content

v0.3.3

Choose a tag to compare

@slowy07 slowy07 released this 29 May 01:41
· 86 commits to main since this release
v0.3.3
c04fdc3

Sniffercommit format Mode

Sniffercommit can run --format using clang-format in-place code formatting

run clang-format in-place on your files without running the full check suite

# format staged files
sniffercommit run --format

# format all traced files
sniffercommit run --format --all-files

# format specific files
sniffercommit run --format src/main.cpp include/foo.hpp

# dry-run
sniffercommit run --format --dry-run --all-files

requirements:

  • clang-format: must be installed and available in PATH
  • .clang-format config file must be exists (generated via sniffercommit init)

Format in Pre-Commit Hook

to auto-format on every commit, pass --format to check:

sniffercommit install

# config git hook to use
.git/hooks/pre-commit --format

Dependency Management

sniffercommit supports adding external C++ dependencies to your project via CMake FetchContent. Dependencies are declared during sniffercommit init and validated before any files are created.


Overview

When you enable CMake scaffolding (--enable-cmake or interactive mode), sniffercommit can automatically generate FetchContent_Declare blocks in your CMakeLists.txt. Each dependency requires:

Field Description Example
name Package name (used for CMake target namespace) fmt
git_url HTTPS or SSH Git URL ending in .git https://github.com/fmtlib/fmt.git
git_tag Branch, tag, or commit SHA to fetch 11.0.2, main, v3.4.0

Quick Start

Interactive Mode

cd my-project
sniffercommit init

When prompted for CMake options, answer y to add dependencies:

  add dependencies [n]: y

  enter dependency info (empty name to finish)

  dep name []: fmt
  git url [https://github.com/fmt/fmt.git]: https://github.com/fmtlib/fmt.git
  git tag [main]: 11.0.2
    ✓ added fmt

  dep name []: tomlplusplus
  git url [https://github.com/tomlplusplus/tomlplusplus.git]: 
  git tag [main]: v3.4.0
    ✓ added tomlplusplus

  dep name []: 

Press Enter at dep name with no input to finish.

Install

# System-wide install
sudo cmake --install build

# Or create Debian package
cd build && cpack -G DEB
sudo dpkg -i sniffercommit_*.deb

# Install via pacman (AUR)
yay -S sniffercommit

Note

Portable binary currently support musl only, check by `ldd --version``