diff --git a/.config/.readthedocs.yaml b/.config/.readthedocs.yaml index ffda996..4cd1762 100644 --- a/.config/.readthedocs.yaml +++ b/.config/.readthedocs.yaml @@ -9,20 +9,16 @@ build: os: ubuntu-22.04 tools: rust: latest - commands: - # install cargo-binstall - - >- - curl - -L --proto '=https' --tlsv1.2 -sSf - https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh - | bash - # add .cargo bin to PATH - # install mdbook and mdbook-alerts - # build docs - - >- - PATH=/home/docs/.cargo/bin:$PATH && - cargo binstall --install-path /home/docs/.cargo/bin -y mdbook mdbook-alerts && - mdbook build docs - # move HTML output to required RTD output path - - mkdir -p ${READTHEDOCS_OUTPUT} - - mv docs/book/html/ "${READTHEDOCS_OUTPUT}" + python: latest + +mkdocs: + configuration: docs/mkdocs.yml + + +# Optionally declare the Python requirements required to build your docs + +python: + install: + - requirements: docs/requirements.txt + - method: pip + path: docs/ diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 75f7f0e..c416df0 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -36,7 +36,7 @@ jobs: key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }} - run: cargo fetch - build-mdbook: + build-mkdocs: runs-on: ubuntu-latest needs: [cache-deps] permissions: @@ -48,26 +48,30 @@ jobs: with: path: ~/.cargo key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }} - - name: Install mdbook - uses: taiki-e/install-action@v2 + - uses: actions/setup-python@v5 with: - tool: mdbook,cargo-binstall,just - - name: Install mdbook plugins - run: cargo binstall -y mdbook-alerts - - name: Build book - run: just docs-build + python-version: 3.x + cache: 'pip' + cache-dependency-path: docs/requirements.txt + - name: Install workflow deps + run: | + pip install -r docs/requirements.txt + pip install --force-reinstall -v docs/ + - name: Build docs + working-directory: docs + run: mkdocs build - name: Upload docs build as artifact uses: actions/upload-artifact@v4 with: name: cpp-linter-docs - path: docs/book/html + path: docs/site - name: Upload to github pages # only publish doc changes from main branch if: github.ref == 'refs/heads/main' uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs/book/html + publish_dir: docs/site build-rustdoc: runs-on: ubuntu-latest @@ -80,7 +84,7 @@ jobs: with: path: ~/.cargo key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }} - - name: Install mdbook + - name: Install just uses: taiki-e/install-action@v2 with: tool: just diff --git a/.gitignore b/.gitignore index b710d73..4c683a4 100644 --- a/.gitignore +++ b/.gitignore @@ -338,8 +338,8 @@ debug/ !.vscode/tasks.json !.vscode/extensions.json -# mdbook builds -book +# mkdocs builds +docs/site # ignore generated files .cpp-linter_cache/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 60a162c..75f051b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,7 @@ repos: - id: check-added-large-files args: [--maxkb=9000] - id: check-yaml + exclude: docs/mkdocs.yml - id: check-toml - id: requirements-txt-fixer - id: mixed-line-ending diff --git a/.vscode/tasks.json b/.vscode/tasks.json index fa18fc0..1a45b15 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -161,11 +161,12 @@ }, { "type": "shell", - "command": "mdbook", - "label": "mdbook: serve", + "command": "mkdocs", + "label": "mkdocs: serve", "args": [ "serve", - "docs", + " --config-file", + "docs/mkdocs.yml", "--open" ], "problemMatcher": [], @@ -173,12 +174,12 @@ }, { "type": "shell", - "command": "mdbook", - "label": "mdbook: build", + "command": "mkdocs", + "label": "mkdocs: build", "args": [ "build", - "docs", - "--open" + " --config-file", + "docs/mkdocs.yml" ], "presentation": { "close": true, diff --git a/Cargo.lock b/Cargo.lock index a5fc866..bbcf761 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,19 +26,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ammonia" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab99eae5ee58501ab236beb6f20f6ca39be615267b014899c89b2f0bc18a459" -dependencies = [ - "html5ever", - "maplit", - "once_cell", - "tendril", - "url", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -127,9 +114,9 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" @@ -146,50 +133,18 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bstr" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" -dependencies = [ - "memchr", - "regex-automata", - "serde", -] - [[package]] name = "bumpalo" version = "3.16.0" @@ -210,9 +165,9 @@ checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cc" -version = "1.1.21" +version = "1.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" +checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0" dependencies = [ "jobserver", "libc", @@ -258,16 +213,6 @@ dependencies = [ "anstyle", "clap_lex", "strsim", - "terminal_size", -] - -[[package]] -name = "clap_complete" -version = "4.5.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8937760c3f4c60871870b8c3ee5f9b30771f792a7045c48bcbba999d7d6b3b8e" -dependencies = [ - "clap", ] [[package]] @@ -278,13 +223,10 @@ checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "cli-gen" -version = "0.1.0" +version = "0.0.0" dependencies = [ - "clap", "cpp-linter", - "mdbook", - "semver", - "serde_json", + "pyo3", ] [[package]] @@ -376,59 +318,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "cpufeatures" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" -dependencies = [ - "libc", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - [[package]] name = "ctor" version = "0.2.8" @@ -439,51 +328,12 @@ dependencies = [ "syn", ] -[[package]] -name = "data-encoding" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" - -[[package]] -name = "dbus" -version = "0.9.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b" -dependencies = [ - "libc", - "libdbus-sys", - "winapi", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - [[package]] name = "either" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" -[[package]] -name = "elasticlunr-rs" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41e83863a500656dfa214fee6682de9c5b9f03de6860fec531235ed2ae9f6571" -dependencies = [ - "regex", - "serde", - "serde_derive", - "serde_json", -] - [[package]] name = "encoding_rs" version = "0.8.34" @@ -493,29 +343,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "env_filter" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" -dependencies = [ - "log", - "regex", -] - -[[package]] -name = "env_logger" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" -dependencies = [ - "anstream", - "anstyle", - "env_filter", - "humantime", - "log", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -544,18 +371,6 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" -[[package]] -name = "filetime" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" -dependencies = [ - "cfg-if", - "libc", - "libredox", - "windows-sys 0.59.0", -] - [[package]] name = "fnv" version = "1.0.7" @@ -586,25 +401,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fsevent-sys" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" -dependencies = [ - "libc", -] - -[[package]] -name = "futf" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" -dependencies = [ - "mac", - "new_debug_unreachable", -] - [[package]] name = "futures" version = "0.3.30" @@ -694,16 +490,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - [[package]] name = "getrandom" version = "0.2.15" @@ -727,7 +513,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" dependencies = [ - "bitflags 2.6.0", + "bitflags", "libc", "libgit2-sys", "log", @@ -736,38 +522,6 @@ dependencies = [ "url", ] -[[package]] -name = "globset" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "h2" version = "0.4.6" @@ -779,7 +533,7 @@ dependencies = [ "fnv", "futures-core", "futures-sink", - "http 1.1.0", + "http", "indexmap", "slab", "tokio", @@ -787,50 +541,12 @@ dependencies = [ "tracing", ] -[[package]] -name = "handlebars" -version = "5.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b" -dependencies = [ - "log", - "pest", - "pest_derive", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -[[package]] -name = "headers" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" -dependencies = [ - "base64 0.21.7", - "bytes", - "headers-core", - "http 0.2.12", - "httpdate", - "mime", - "sha1", -] - -[[package]] -name = "headers-core" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" -dependencies = [ - "http 0.2.12", -] - [[package]] name = "heck" version = "0.5.0" @@ -852,31 +568,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "html5ever" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" -dependencies = [ - "log", - "mac", - "markup5ever", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http" version = "1.1.0" @@ -888,17 +579,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - [[package]] name = "http-body" version = "1.0.1" @@ -906,7 +586,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http", ] [[package]] @@ -917,8 +597,8 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http 1.1.0", - "http-body 1.0.1", + "http", + "http-body", "pin-project-lite", ] @@ -934,36 +614,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "hyper" -version = "0.14.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "1.4.1" @@ -973,9 +623,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.6", - "http 1.1.0", - "http-body 1.0.1", + "h2", + "http", + "http-body", "httparse", "httpdate", "itoa", @@ -992,8 +642,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", - "http 1.1.0", - "hyper 1.4.1", + "http", + "hyper", "hyper-util", "rustls", "rustls-pki-types", @@ -1010,7 +660,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.4.1", + "hyper", "hyper-util", "native-tls", "tokio", @@ -1020,20 +670,19 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", - "http-body 1.0.1", - "hyper 1.4.1", + "http", + "http-body", + "hyper", "pin-project-lite", "socket2", "tokio", - "tower", "tower-service", "tracing", ] @@ -1071,22 +720,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "ignore" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" -dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", -] - [[package]] name = "indexmap" version = "2.5.0" @@ -1103,26 +736,6 @@ version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" -[[package]] -name = "inotify" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" -dependencies = [ - "bitflags 1.3.2", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - [[package]] name = "ipnet" version = "2.10.0" @@ -1159,26 +772,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "kqueue" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c" -dependencies = [ - "kqueue-sys", - "libc", -] - -[[package]] -name = "kqueue-sys" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" -dependencies = [ - "bitflags 1.3.2", - "libc", -] - [[package]] name = "lazy_static" version = "1.5.0" @@ -1216,19 +809,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.158" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" - -[[package]] -name = "libdbus-sys" -version = "0.2.5" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06085512b750d640299b79be4bad3d2fa90a9c00b1fd9e1b46364f66f0485c72" -dependencies = [ - "cc", - "pkg-config", -] +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libgit2-sys" @@ -1254,17 +837,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.6.0", - "libc", - "redox_syscall", -] - [[package]] name = "libssh2-sys" version = "0.3.0" @@ -1313,68 +885,6 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" -[[package]] -name = "mac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" - -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - -[[package]] -name = "markup5ever" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" -dependencies = [ - "log", - "phf", - "phf_codegen", - "string_cache", - "string_cache_codegen", - "tendril", -] - -[[package]] -name = "mdbook" -version = "0.4.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45a38e19bd200220ef07c892b0157ad3d2365e5b5a267ca01ad12182491eea5" -dependencies = [ - "ammonia", - "anyhow", - "chrono", - "clap", - "clap_complete", - "elasticlunr-rs", - "env_logger", - "futures-util", - "handlebars", - "ignore", - "log", - "memchr", - "notify", - "notify-debouncer-mini", - "once_cell", - "opener", - "pathdiff", - "pulldown-cmark", - "regex", - "serde", - "serde_json", - "shlex", - "tempfile", - "tokio", - "toml", - "topological-sort", - "walkdir", - "warp", -] - [[package]] name = "memchr" version = "2.7.4" @@ -1396,16 +906,6 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "mime_guess" -version = "2.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "miniz_oxide" version = "0.8.0" @@ -1415,18 +915,6 @@ dependencies = [ "adler2", ] -[[package]] -name = "mio" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.48.0", -] - [[package]] name = "mio" version = "1.0.2" @@ -1449,10 +937,10 @@ dependencies = [ "bytes", "colored", "futures-util", - "http 1.1.0", - "http-body 1.0.1", + "http", + "http-body", "http-body-util", - "hyper 1.4.1", + "hyper", "hyper-util", "log", "rand", @@ -1469,7 +957,7 @@ version = "2.16.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53575dfa17f208dd1ce3a2da2da4659aae393b256a472f2738a8586a6c4107fd" dependencies = [ - "bitflags 2.6.0", + "bitflags", "ctor", "napi-derive", "napi-sys", @@ -1538,51 +1026,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "new_debug_unreachable" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" - -[[package]] -name = "normpath" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "notify" -version = "6.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" -dependencies = [ - "bitflags 2.6.0", - "crossbeam-channel", - "filetime", - "fsevent-sys", - "inotify", - "kqueue", - "libc", - "log", - "mio 0.8.11", - "walkdir", - "windows-sys 0.48.0", -] - -[[package]] -name = "notify-debouncer-mini" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d40b221972a1fc5ef4d858a2f671fb34c75983eb385463dff3780eeff6a9d43" -dependencies = [ - "crossbeam-channel", - "log", - "notify", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1599,24 +1042,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +] [[package]] -name = "opener" -version = "0.7.2" +name = "once_cell" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0812e5e4df08da354c851a3376fead46db31c2214f849d3de356d774d057681" +checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" dependencies = [ - "bstr", - "dbus", - "normpath", - "windows-sys 0.59.0", + "portable-atomic", ] [[package]] @@ -1625,7 +1059,7 @@ version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.6.0", + "bitflags", "cfg-if", "foreign-types", "libc", @@ -1696,140 +1130,12 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "pathdiff" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" - [[package]] name = "percent-encoding" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pest" -version = "2.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9" -dependencies = [ - "memchr", - "thiserror", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3a6e3394ec80feb3b6393c725571754c6188490265c61aaf260810d6b95aa0" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94429506bde1ca69d1b5601962c73f4172ab4726571a59ea95931218cb0e930e" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac8a071862e93690b6e34e9a5fb8e33ff3734473ac0245b27232222c4906a33f" -dependencies = [ - "once_cell", - "pest", - "sha2", -] - -[[package]] -name = "phf" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" -dependencies = [ - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_codegen" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" -dependencies = [ - "phf_generator 0.11.2", - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_generator" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" -dependencies = [ - "phf_shared 0.10.0", - "rand", -] - -[[package]] -name = "phf_generator" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" -dependencies = [ - "phf_shared 0.11.2", - "rand", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "pin-project-lite" version = "0.2.14" @@ -1844,15 +1150,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d30538d42559de6b034bc76fd6dd4c38961b1ee5c6c56e3808c50128fdbc22ce" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" [[package]] name = "ppv-lite86" @@ -1863,12 +1169,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - [[package]] name = "proc-macro2" version = "1.0.86" @@ -1878,24 +1178,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "pulldown-cmark" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76979bea66e7875e7509c4ec5300112b316af87fa7a252ca91c448b32dfe3993" -dependencies = [ - "bitflags 2.6.0", - "memchr", - "pulldown-cmark-escape", - "unicase", -] - -[[package]] -name = "pulldown-cmark-escape" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd348ff538bc9caeda7ee8cad2d1d48236a1f443c1fa3913c6a02fe0043b1dd3" - [[package]] name = "pyo3" version = "0.22.3" @@ -2000,18 +1282,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b" dependencies = [ - "bitflags 2.6.0", + "bitflags", ] [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", @@ -2021,9 +1303,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", @@ -2032,9 +1314,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" @@ -2042,16 +1324,16 @@ version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2 0.4.6", - "http 1.1.0", - "http-body 1.0.1", + "h2", + "http", + "http-body", "http-body-util", - "hyper 1.4.1", + "hyper", "hyper-rustls", "hyper-tls", "hyper-util", @@ -2106,7 +1388,7 @@ version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ - "bitflags 2.6.0", + "bitflags", "errno", "libc", "linux-raw-sys", @@ -2132,15 +1414,15 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ - "base64 0.22.1", + "base64", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" [[package]] name = "rustls-webpki" @@ -2159,15 +1441,6 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "schannel" version = "0.1.24" @@ -2177,12 +1450,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - [[package]] name = "scopeguard" version = "1.2.0" @@ -2195,7 +1462,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.6.0", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -2274,28 +1541,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - [[package]] name = "shlex" version = "1.3.0" @@ -2308,12 +1553,6 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e" -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - [[package]] name = "slab" version = "0.4.9" @@ -2345,32 +1584,6 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared 0.10.0", - "precomputed-hash", - "serde", -] - -[[package]] -name = "string_cache_codegen" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" -dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", - "proc-macro2", - "quote", -] - [[package]] name = "strsim" version = "0.11.1" @@ -2385,9 +1598,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -2409,7 +1622,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 2.6.0", + "bitflags", "core-foundation", "system-configuration-sys", ] @@ -2432,9 +1645,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", @@ -2443,41 +1656,20 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "tendril" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" -dependencies = [ - "futf", - "mac", - "utf-8", -] - -[[package]] -name = "terminal_size" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" -dependencies = [ - "rustix", - "windows-sys 0.48.0", -] - [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", @@ -2508,7 +1700,7 @@ dependencies = [ "backtrace", "bytes", "libc", - "mio 1.0.2", + "mio", "parking_lot", "pin-project-lite", "socket2", @@ -2559,18 +1751,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-tungstenite" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite", -] - [[package]] name = "tokio-util" version = "0.7.12" @@ -2584,42 +1764,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] -name = "topological-sort" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" - -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - [[package]] name = "tower-service" version = "0.3.3" @@ -2632,7 +1776,6 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "log", "pin-project-lite", "tracing-core", ] @@ -2652,46 +1795,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "tungstenite" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http 1.1.0", - "httparse", - "log", - "rand", - "sha1", - "thiserror", - "url", - "utf-8", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "ucd-trie" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" - -[[package]] -name = "unicase" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.15" @@ -2742,12 +1845,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - [[package]] name = "utf8parse" version = "0.2.2" @@ -2760,22 +1857,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "want" version = "0.3.1" @@ -2785,34 +1866,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "warp" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4378d202ff965b011c64817db11d5829506d3404edeadb61f190d111da3f231c" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "headers", - "http 0.2.12", - "hyper 0.14.30", - "log", - "mime", - "mime_guess", - "percent-encoding", - "pin-project", - "scoped-tls", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-tungstenite", - "tokio-util", - "tower-service", - "tracing", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2908,37 +1961,6 @@ dependencies = [ "winsafe", ] -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-core" version = "0.52.0" diff --git a/README.md b/README.md index 089e8e1..4352e2f 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,22 @@ -[file-annotations]: https://cpp-linter.github.io/cpp-linter-rs/cli#-a---file-annotations -[thread-comments]: https://cpp-linter.github.io/cpp-linter-rs/cli#-g---thread-comments -[step-summary]: https://cpp-linter.github.io/cpp-linter-rs/cli#-w---step-summary -[tidy-review]: https://cpp-linter.github.io/cpp-linter-rs/cli#-d---tidy-review -[format-review]: https://cpp-linter.github.io/cpp-linter-rs/cli#-m---format-review - -[format-annotations-preview]: docs/src/images/annotations-clang-format.png -[tidy-annotations-preview]: docs/src/images/annotations-clang-tidy.png -[step-summary-preview]: docs/src/images/step-summary.png -[thread-comment-preview]: docs/src/images/comment.png -[tidy-review-preview]: docs/src/images/tidy-review.png -[format-review-preview]: docs/src/images/format-review.png -[format-suggestion-preview]: docs/src/images/format-suggestion.png - +[file-annotations]: https://cpp-linter.github.io/cpp-linter-rs/cli#-a-file-annotations +[thread-comments]: https://cpp-linter.github.io/cpp-linter-rs/cli#-g-thread-comments +[step-summary]: https://cpp-linter.github.io/cpp-linter-rs/cli#-w-step-summary +[tidy-review]: https://cpp-linter.github.io/cpp-linter-rs/cli#-d-tidy-review +[format-review]: https://cpp-linter.github.io/cpp-linter-rs/cli#-m-format-review + +[format-annotations-preview]: docs/docs/images/annotations-clang-format.png +[tidy-annotations-preview]: docs/docs/images/annotations-clang-tidy.png +[step-summary-preview]: docs/docs/images/step-summary.png +[thread-comment-preview]: docs/docs/images/comment.png +[tidy-review-preview]: docs/docs/images/tidy-review.png +[format-review-preview]: docs/docs/images/format-review.png +[format-suggestion-preview]: docs/docs/images/format-suggestion.png + +[cli-doc]: https://cpp-linter.github.io/cpp-linter-rs/cli.html + + [![Python packaging][py-build-badge]][py-build-ci] [![Binary executable builds][bin-build-badge]][bin-build-ci] [![node-js builds][node-ci-badge]][node-ci] @@ -56,7 +59,7 @@ A package for linting C/C++ code with clang-tidy and/or clang-format to collect - [x] [file-annotations](#annotations) - [x] [Pull Request Review](#pull-request-review) suggestions -> [!CAUTION] +> [!WARNING] > This project is still experimental and subject to drastic changes. > Please use the [pure python cpp-linter](https://github.com/cpp-linter/cpp-linter) > package until this project is ready for deployment. @@ -118,7 +121,7 @@ For usage in a CI workflow, see [the cpp-linter/cpp-linter-action repository](https://github.com/cpp-linter/cpp-linter-action). For the description of supported Command Line Interface options, see -[the CLI documentation](https://cpp-linter.github.io/cpp-linter-rs/cli.html). +[the CLI documentation][cli-doc]. ## Example diff --git a/cpp-linter/src/cli/mod.rs b/cpp-linter/src/cli/mod.rs index dd04101..9ce03b2 100644 --- a/cpp-linter/src/cli/mod.rs +++ b/cpp-linter/src/cli/mod.rs @@ -57,9 +57,9 @@ for an example of setting up Clang Tooling on a source tree.", - Set this to a blank string (`''`) to disable using clang-format entirely. -> [!note] +> [!NOTE] > If this is not a blank string, then it is also passed to clang-tidy -> (if [`--tidy_checks`](#-c---tidy-checks) is not `-*`). +> (if [`--tidy_checks`](#-c-tidy-checks) is not `-*`). > This is done to ensure suggestions from both clang-tidy and > clang-format are consistent.\n\n", ), @@ -142,7 +142,7 @@ the current working directory if not using a CI runner).\n\n", - There is no need to use `./` for each entry; a blank string (`''`) represents the repo-root path. - This can also have files, but the file's path (relative to - the [`--repo-root`](#-r---repo-root)) has to be specified with the filename. + the [`--repo-root`](#-r-repo-root)) has to be specified with the filename. - Submodules are automatically ignored. Hidden directories (beginning with a `.`) are also ignored automatically. - Prefix a path with `!` to explicitly not ignore it. This can be @@ -158,7 +158,7 @@ the current working directory if not using a CI runner).\n\n", .value_delimiter('|') .help_heading("clang-tidy options") .help( - "Similar to [`--ignore`](#-i---ignore) but applied + "Similar to [`--ignore`](#-i-ignore) but applied exclusively to files analyzed by clang-tidy.\n\n", ), ) @@ -169,7 +169,7 @@ exclusively to files analyzed by clang-tidy.\n\n", .value_delimiter('|') .help_heading("clang-format options") .help( - "Similar to [`--ignore`](#-i---ignore) but applied + "Similar to [`--ignore`](#-i-ignore) but applied exclusively to files analyzed by clang-format.\n\n", ), ) @@ -201,9 +201,9 @@ The following values are accepted: .help( "Set this option to false to analyze any source files in the repo. This is automatically enabled if -[`--lines-changed-only`](#-l---lines-changed-only) is enabled. +[`--lines-changed-only`](#-l-lines-changed-only) is enabled. -> [!note] +> [!NOTE] > The `GITHUB_TOKEN` should be supplied when running on a > private repository with this option enabled, otherwise the runner > does not not have the privilege to list the changed files for an event. @@ -241,7 +241,7 @@ cpp-linter --extra-arg="-std=c++17" --extra-arg="-Wall" Set this to `update` to update an existing comment if one exists; the value 'true' will always delete an old comment and post a new one if necessary. -> [!note] +> [!NOTE] > To use thread comments, the `GITHUB_TOKEN` (provided by > Github to each repository) must be declared as an environment > variable. @@ -261,8 +261,8 @@ the value 'true' will always delete an old comment and post a new one if necessa "Set this option to true or false to enable or disable the use of a thread comment that basically says 'Looks Good To Me' (when all checks pass). -> [!important] -> The [`--thread-comments`](#-g---thread-comments) +> [!IMPORTANT] +> The [`--thread-comments`](#-g-thread-comments) > option also notes further implications.\n\n", ), ) diff --git a/cspell.config.yml b/cspell.config.yml index 800dd06..a69f735 100644 --- a/cspell.config.yml +++ b/cspell.config.yml @@ -18,22 +18,28 @@ words: - endmacro - endwith - Falsey + - fontawesome - gitmodules + - inlinehilite - iomanip - libc - libgit + - linenums - markdownlint - maturin - mdbook + - mkdocs - msvc - napi - nonminimal - peekable - pkgs + - positionals - posix - preprocess - pybind - pyfunction + - pymdownx - pymodule - pypa - pypi @@ -42,8 +48,11 @@ words: - reqwest - revparse - serde + - superfences + - tasklist - tempdir - tempfile + - twemoji - vararg - venv ignorePaths: diff --git a/docs/Cargo.toml b/docs/Cargo.toml index 628de46..bbc84e3 100644 --- a/docs/Cargo.toml +++ b/docs/Cargo.toml @@ -2,8 +2,8 @@ [package] name = "cli-gen" edition = "2021" -version = "0.1.0" -description = "A mdbook pre-processor that generates a CLI doc from source code." +version = "0.0.0" +description = "A function exposed in python that generates a CLI doc from rust source code." repository = "https://github.com/cpp-linter/cpp-linter-rs/tree/main/docs" authors.workspace = true homepage.workspace = true @@ -11,11 +11,8 @@ license.workspace = true [dependencies] cpp-linter = { path = "../cpp-linter" } -clap = "4.5.17" -mdbook = "0.4.40" -semver = "1.0.23" -serde_json = "1.0.128" +pyo3 = "0.22.3" -[[bin]] -name = "cli-gen" -path = "src/main.rs" +[lib] +name = "cli_gen" +crate-type = ["cdylib"] diff --git a/docs/README.md b/docs/README.md index f78c92f..729dd45 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,13 +8,14 @@ Please [visit our website][gh-pages] to see generated documentation. To view the documentation locally, some software needs to be installed. ```shell -cargo install --locked cargo-binstall -cargo binstall -y mdbook mdbook-alerts +pip install maturin +cd docs +maturin dev +pip install -r docs/requirements.txt ``` -Then use `mdbook` to generate the docs and open them in your browser. +Then use `mkdocs` to generate the docs and open them in your browser. ```shell -# in repo root folder -mdbook serve docs --open +mkdocs serve --open ``` diff --git a/docs/badge_hook.py b/docs/badge_hook.py new file mode 100644 index 0000000..84b37ef --- /dev/null +++ b/docs/badge_hook.py @@ -0,0 +1,94 @@ +"""A mkdocs hook that injects an HTML syntax used to generate badges at build time.""" + +import re +from re import Match +from mkdocs.config.defaults import MkDocsConfig +from mkdocs.structure.files import Files +from mkdocs.structure.pages import Page + + +def on_page_markdown(markdown: str, *, page: Page, config: MkDocsConfig, files: Files): + # Replace callback + def replace(match: Match): + badge_type, args = match.groups() + args = args.strip() + if badge_type == "version": + return _badge_for_version(args, page, files) + elif badge_type == "flag": + return _badge_for_flags(args, page, files) + elif badge_type == "permission": + return _badge_for_permissions(args, page, files) + elif badge_type == "default": + return _badge_for_default(args, page, files) + + # Otherwise, raise an error + raise RuntimeError(f"Unknown badge type: {badge_type}") + + # Find and replace all external asset URLs in current page + return re.sub(r"", replace, markdown, flags=re.I | re.M) + + +# ----------------------------------------------------------------------------- +# Helper functions + + +def _badge_for_flags(arg, page: Page, files: Files): + if arg == "experimental": + return _badge_for_experimental(page, files) + raise ValueError(f"Unsupported badge flag: {arg}") + + +# Create badge +def _badge(icon: str, text: str = ""): + return "".join( + [ + '', + *([f'{icon}'] if icon else []), + *([f'{text}'] if text else []), + "", + ] + ) + + +# Create badge for version +def _badge_for_version(text: str, page: Page, files: Files): + icon = "material-tag-outline" + repo = "cpp-linter/cpp-linter-rs" + version = tuple(int(x.lstrip("v")) for x in text.split(".")) + if version < (1, 4, 6): + repo = "cpp-linter/cpp-linter-action" + elif version[0] == 1: + repo = "cpp-linter/cpp-linter" + href = f"https://github.com/{repo}/releases/" + ( + f"v{text}" if text[0:1].isdigit() else text + ) + return _badge( + icon=f'[:{icon}:]({href} "minimum version")', + text=f'[{text}]({href} "minimum version")', + ) + + +# Create badge for default value +def _badge_for_default(text: str, page: Page, files: Files): + return _badge(icon="Default", text=f"`#!yaml {text}`") + + +# Create badge for required value flag +def _badge_for_permissions(args: str, page: Page, files: Files): + match_permission = re.match(r"([^#]+)(.*)", args) + if match_permission is None: + raise ValueError(f"failed to parse permissions from {args}") + permission, link = match_permission.groups()[:2] + permission = permission.strip() + link = "permissions.md" + link + icon = "material-lock" + return _badge( + icon=f'[:{icon}:]({link} "required permissions")', + text=f'[`#!yaml {permission}`]({link} "required permission")', + ) + + +# Create badge for experimental flag +def _badge_for_experimental(page: Page, files: Files): + icon = "material-flask-outline" + return _badge(icon=f":{icon}:{{ .mdx-badge--heart }}", text="experimental") diff --git a/docs/book.toml b/docs/book.toml deleted file mode 100644 index 9cc1083..0000000 --- a/docs/book.toml +++ /dev/null @@ -1,36 +0,0 @@ -[book] -authors = ["Brendan Doherty"] -language = "en" -multilingual = false -src = "src" -title = "cpp-linter" -description = "Some documentation about the cpp-linter-rs project" - -[build] -create-missing = false -build-dir = "book/html" - -[output.html] -theme = "theme" -default-theme = "ayu" -preferred-dark-theme = "ayu" -git-repository-url = "https://github.com/cpp-linter/cpp-linter-rs" -additional-css = ["theme/pagetoc.css"] -additional-js = ["theme/pagetoc.js"] - -[preprocessor.alerts] -after = ["links"] - -[preprocessor.cli-gen] -command = "cargo run --bin cli-gen" -before = ["links"] -groups-order = [ - "General options", - "Source options", - "Clang-format options", - "Clang-tidy options", - "Feedback options", -] - -# [output.markdown] -# for debugging the cli-gen preprocessor (src/main.rs) diff --git a/docs/cli.yml b/docs/cli.yml new file mode 100644 index 0000000..4932ef7 --- /dev/null +++ b/docs/cli.yml @@ -0,0 +1,58 @@ +# file to hold metadata about the action.yml inputs and outputs +inputs: + style: + minimum-version: '1.4.6' + extensions: + minimum-version: '1.4.6' + tidy-checks: + minimum-version: '1.4.6' + repo-root: + minimum-version: '1.4.6' + version: + minimum-version: '1.4.6' + verbosity: + minimum-version: '1.3.0' + lines-changed-only: + minimum-version: '1.5.0' + required-permission: 'contents: read #file-changes' + files-changed-only: + minimum-version: '1.3.0' + required-permission: 'contents: read #file-changes' + ignore: + minimum-version: '1.3.0' + ignore-tidy: + minimum-version: '1.9.0' + ignore-format: + minimum-version: '1.9.0' + thread-comments: + minimum-version: '1.6.1' + required-permission: 'contents: write #thread-comments' + no-lgtm: + minimum-version: '1.6.1' + step-summary: + minimum-version: '1.6.0' + file-annotations: + minimum-version: '1.4.3' + database: + minimum-version: '1.4.0' + extra-args: + minimum-version: '1.4.7' + tidy-review: + minimum-version: '1.7.0' + experimental: true + required-permission: 'pull-requests: write #pull-request-reviews' + format-review: + minimum-version: '1.7.0' + required-permission: 'pull-requests: write #pull-request-reviews' + passive-reviews: + minimum-version: '1.10.0' + required-permission: 'pull-requests: write #pull-request-reviews' + jobs: + minimum-version: '1.8.1' +outputs: + checks-failed: + minimum-version: '1.4.6' + clang-tidy-checks-failed: + minimum-version: '1.6.2' + clang-format-checks-failed: + minimum-version: '1.6.2' diff --git a/docs/cli_gen.pyi b/docs/cli_gen.pyi new file mode 100644 index 0000000..9370c53 --- /dev/null +++ b/docs/cli_gen.pyi @@ -0,0 +1,3 @@ +from typing import Dict, Any + +def generate_cli_doc(metadata: Dict[str, Dict[str, Any]]) -> str: ... diff --git a/docs/docs/changelog.md b/docs/docs/changelog.md new file mode 100644 index 0000000..633db5d --- /dev/null +++ b/docs/docs/changelog.md @@ -0,0 +1,8 @@ +--- +title: Changes +--- + + +{% + include "../../CHANGELOG.md" +%} diff --git a/docs/src/cli.md b/docs/docs/cli.md similarity index 58% rename from docs/src/cli.md rename to docs/docs/cli.md index 5b528e3..ef55c86 100644 --- a/docs/src/cli.md +++ b/docs/docs/cli.md @@ -5,12 +5,6 @@ > This document is generated during a Continuous Integration workflow. > Please refer to the [generated version of this document][gh-pages] instead. > -> To view this document locally, run the following command from project root: -> -> ```shell -> mdbook serve docs -> ``` -> -> See also [docs/README](../README.md) for more information. +> To view this document locally, see the [docs/README](../README.md) for instructions. [gh-pages]: https://cpp-linter.github.io/cpp-linter-rs/cli.html diff --git a/docs/src/images/annotations-clang-format.png b/docs/docs/images/annotations-clang-format.png similarity index 100% rename from docs/src/images/annotations-clang-format.png rename to docs/docs/images/annotations-clang-format.png diff --git a/docs/src/images/annotations-clang-tidy.png b/docs/docs/images/annotations-clang-tidy.png similarity index 100% rename from docs/src/images/annotations-clang-tidy.png rename to docs/docs/images/annotations-clang-tidy.png diff --git a/docs/src/images/comment.png b/docs/docs/images/comment.png similarity index 100% rename from docs/src/images/comment.png rename to docs/docs/images/comment.png diff --git a/docs/docs/images/favicon.ico b/docs/docs/images/favicon.ico new file mode 100644 index 0000000..c5de55c Binary files /dev/null and b/docs/docs/images/favicon.ico differ diff --git a/docs/src/images/format-review.png b/docs/docs/images/format-review.png similarity index 100% rename from docs/src/images/format-review.png rename to docs/docs/images/format-review.png diff --git a/docs/src/images/format-suggestion.png b/docs/docs/images/format-suggestion.png similarity index 100% rename from docs/src/images/format-suggestion.png rename to docs/docs/images/format-suggestion.png diff --git a/docs/theme/favicon.png b/docs/docs/images/logo.png similarity index 100% rename from docs/theme/favicon.png rename to docs/docs/images/logo.png diff --git a/docs/src/images/step-summary.png b/docs/docs/images/step-summary.png similarity index 100% rename from docs/src/images/step-summary.png rename to docs/docs/images/step-summary.png diff --git a/docs/src/images/tidy-review.png b/docs/docs/images/tidy-review.png similarity index 100% rename from docs/src/images/tidy-review.png rename to docs/docs/images/tidy-review.png diff --git a/docs/src/index.md b/docs/docs/index.md similarity index 59% rename from docs/src/index.md rename to docs/docs/index.md index 9a774e8..627e8a7 100644 --- a/docs/src/index.md +++ b/docs/docs/index.md @@ -1,10 +1,10 @@ -[file-annotations]: cli.md#-a---file-annotations -[thread-comments]: cli.md#-g---thread-comments -[step-summary]: cli.md#-w---step-summary -[tidy-review]: cli.md#-d---tidy-review -[format-review]: cli.md#-m---format-review +[file-annotations]: cli.md#-a-file-annotations +[thread-comments]: cli.md#-g-thread-comments +[step-summary]: cli.md#-w-step-summary +[tidy-review]: cli.md#-d-tidy-review +[format-review]: cli.md#-m-format-review [format-annotations-preview]: images/annotations-clang-format.png [tidy-annotations-preview]: images/annotations-clang-tidy.png @@ -14,4 +14,9 @@ [format-review-preview]: images/format-review.png [format-suggestion-preview]: images/format-suggestion.png -{{#include ../../README.md:16:}} +[cli-doc]: cli.md + +{% + include "../../README.md" + start="" +%} diff --git a/docs/docs/node.md b/docs/docs/node.md new file mode 100644 index 0000000..19b522d --- /dev/null +++ b/docs/docs/node.md @@ -0,0 +1,6 @@ +# Node.js Binding + +{% + include "../../node-binding/README.md" + start="" +%} diff --git a/docs/src/permissions.md b/docs/docs/permissions.md similarity index 81% rename from docs/src/permissions.md rename to docs/docs/permissions.md index 2fab227..299a5cb 100644 --- a/docs/src/permissions.md +++ b/docs/docs/permissions.md @@ -4,7 +4,7 @@ This is an exhaustive list of required permissions organized by features. -> [!important] +> [!IMPORTANT] > The `GITHUB_TOKEN` environment variable should be supplied when running on a private repository. > Otherwise the runner does not not have the privileges needed for the features mentioned here. > @@ -15,8 +15,8 @@ This is an exhaustive list of required permissions organized by features. ## File Changes -When using [`--files-changed-only`](cli.md#-f---files-changed-only) or -[`--lines-changed-only`](cli.md#-l---lines-changed-only) to get the list +When using [`--files-changed-only`](cli.md#-f-files-changed-only) or +[`--lines-changed-only`](cli.md#-l-lines-changed-only) to get the list of file changes for a CI event, the following permissions are needed: ### Push @@ -51,7 +51,7 @@ the repository is not checked out before running cpp-linter. ## Thread Comments -The [`--thread-comments`](cli.md#-g---thread-comments) feature requires the following permissions: +The [`--thread-comments`](cli.md#-g-thread-comments) feature requires the following permissions: ### Push @@ -78,7 +78,7 @@ For [`pull_request` events][pr-events]. ## Pull Request Reviews -The [`tidy-review`](cli.md#-d---tidy-review), [`format-review`](cli.md#-m---format-review), and [`passive-reviews`](cli.md#-r---passive-reviews) features require the following permissions: +The [`tidy-review`](cli.md#-d-tidy-review), [`format-review`](cli.md#-m-format-review), and [`passive-reviews`](cli.md#-r-passive-reviews) features require the following permissions: ```yaml permissions: diff --git a/docs/src/pr-review-caveats.md b/docs/docs/pr-review-caveats.md similarity index 95% rename from docs/src/pr-review-caveats.md rename to docs/docs/pr-review-caveats.md index 26d0f98..955bf33 100644 --- a/docs/src/pr-review-caveats.md +++ b/docs/docs/pr-review-caveats.md @@ -5,12 +5,12 @@ [hiding a comment]: https://docs.github.com/en/communities/moderating-comments-and-conversations/managing-disruptive-comments#hiding-a-comment [resolve a conversation]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/commenting-on-a-pull-request#resolving-conversations -[tidy-review]: cli.md#-d---tidy-review -[format-review]: cli.md#-m---format-review -[lines-changed-only]: cli.md#-l---lines-changed-only -[style]: cli.md#-s---style +[tidy-review]: cli.md#-d-tidy-review +[format-review]: cli.md#-m-format-review +[lines-changed-only]: cli.md#-l-lines-changed-only +[style]: cli.md#-s-style -> [!note] +> [!NOTE] > This information is specific to GitHub Pull Requests (often abbreviated as "PR"). While the Pull Request review feature has been diligently tested, there are still some caveats to @@ -23,7 +23,7 @@ By default, the bot cannot approve Pull Request changes, only request more chang This will show as a warning in the workflow logs if the given token (set to the environment variable `GITHUB_TOKEN`) isn't configured with the proper permissions. -> [!important] +> [!IMPORTANT] > Refer to the GitHub documentation for [repository settings][] or [organization settings][] > about adjusting the required permissions for GitHub Actions's `secrets.GITHUB_TOKEN`. > @@ -50,7 +50,7 @@ Clang-tidy and clang-format suggestions are shown in 1 Pull Request review. Also, the outdated review's summary comment is not automatically hidden. To reduce the Pull Request's thread noise, users interaction is required. -> [!important] +> [!IMPORTANT] > Refer to GitHub's documentation about [hiding a comment][]. > Hiding a Pull Request review's summary comment will not resolve the suggestions in the diff. > Please also refer to [resolve a conversation][] to collapse outdated or duplicate suggestions @@ -58,7 +58,7 @@ Clang-tidy and clang-format suggestions are shown in 1 Pull Request review. GitHub REST API does not provide a way to hide comments or mark review suggestions as resolved. -> [!tip] +> [!TIP] > We do support an environment variable named `CPP_LINTER_PR_REVIEW_SUMMARY_ONLY`. > If the variable is set to `true`, then the review only contains a summary comment > with no suggestions posted in the diff. diff --git a/docs/docs/python.md b/docs/docs/python.md new file mode 100644 index 0000000..87b2a73 --- /dev/null +++ b/docs/docs/python.md @@ -0,0 +1,6 @@ +# Python Binding + +{% + include "../../py-binding/README.md" + start="" +%} diff --git a/docs/docs/stylesheets/extra.css b/docs/docs/stylesheets/extra.css new file mode 100644 index 0000000..abd602f --- /dev/null +++ b/docs/docs/stylesheets/extra.css @@ -0,0 +1,241 @@ +th { + background-color: var(--md-default-fg-color--lightest); +} + +.md-header { + background-color: #4051b5; +} + +.md-typeset .admonition.important, .md-typeset details.important { + border-color: #00b8d4; +} + +.md-typeset .important > .admonition-title::before, .md-typeset .important > summary::before { + background-color: #00b8d4; + -webkit-mask-image: var(--md-admonition-icon--info); + mask-image: var(--md-admonition-icon--info); +} + +.md-typeset .important > .admonition-title, .md-typeset .important > summary { + background-color: #00b8d41a; +} + +@keyframes heart { + + 0%, + 40%, + 80%, + to { + transform: scale(1) + } + + 20%, + 60% { + transform: scale(1.15) + } +} + +.md-typeset .mdx-heart { + animation: heart 1s infinite +} + +.md-typeset .mdx-badge { + font-size: .85em +} + +.md-typeset .mdx-badge--heart { + color: #ff4281; +} + +.md-typeset .mdx-badge--heart.twemoji { + animation: heart 1s infinite +} + +.md-typeset .mdx-badge--right { + float: right; + margin-left: .35em +} + +[dir=ltr] .md-typeset .mdx-badge__icon { + border-top-left-radius: .1rem +} + +[dir=rtl] .md-typeset .mdx-badge__icon { + border-top-right-radius: .1rem +} + +[dir=ltr] .md-typeset .mdx-badge__icon { + border-bottom-left-radius: .1rem +} + +[dir=rtl] .md-typeset .mdx-badge__icon { + border-bottom-right-radius: .1rem +} + +.md-typeset .mdx-badge__icon { + background: var(--md-accent-fg-color--transparent); + padding: .2rem +} + +.md-typeset .mdx-badge__icon:last-child { + border-radius: .1rem +} + +[dir=ltr] .md-typeset .mdx-badge__text { + border-top-right-radius: .1rem +} + +[dir=rtl] .md-typeset .mdx-badge__text { + border-top-left-radius: .1rem +} + +[dir=ltr] .md-typeset .mdx-badge__text { + border-bottom-right-radius: .1rem +} + +[dir=rtl] .md-typeset .mdx-badge__text { + border-bottom-left-radius: .1rem +} + +.md-typeset .mdx-badge__text { + box-shadow: 0 0 0 1px inset var(--md-accent-fg-color--transparent); + padding: .2rem .3rem +} + +.md-typeset .mdx-social { + height: min(27rem, 80vw); + position: relative +} + +.md-typeset .mdx-social:hover .mdx-social__image { + background-color: #e4e4e40d +} + +.md-typeset .mdx-social__layer { + margin-top: 4rem; + position: absolute; + transform-style: preserve-3d; + transition: .25s cubic-bezier(.7, 0, .3, 1) +} + +.md-typeset .mdx-social__layer:hover .mdx-social__label { + opacity: 1 +} + +.md-typeset .mdx-social__layer:hover .mdx-social__image { + background-color: #7f7f7ffc +} + +.md-typeset .mdx-social__layer:hover~.mdx-social__layer { + opacity: 0 +} + +.md-typeset .mdx-social__image { + box-shadow: -.25rem .25rem .5rem #0000000d; + transform: rotate(-40deg) skew(15deg, 15deg) scale(.7); + transition: all .25s +} + +.md-typeset .mdx-social__image img { + display: block +} + +.md-typeset .mdx-social__label { + background-color: var(--md-default-fg-color--light); + color: var(--md-default-bg-color); + display: block; + opacity: 0; + padding: .2rem .4rem; + position: absolute; + transition: all .25s +} + +.md-typeset .mdx-social:hover .mdx-social__layer:nth-child(6) { + transform: translateY(-30px) +} + +.md-typeset .mdx-social:hover .mdx-social__layer:nth-child(5) { + transform: translateY(-20px) +} + +.md-typeset .mdx-social:hover .mdx-social__layer:nth-child(4) { + transform: translateY(-10px) +} + +.md-typeset .mdx-social:hover .mdx-social__layer:nth-child(3) { + transform: translateY(0) +} + +.md-typeset .mdx-social:hover .mdx-social__layer:nth-child(2) { + transform: translateY(10px) +} + +.md-typeset .mdx-social:hover .mdx-social__layer:first-child { + transform: translateY(20px) +} + +.md-typeset .mdx-social:hover .mdx-social__layer:nth-child(0) { + transform: translateY(30px) +} + +.md-banner { + color: var(--md-footer-fg-color--lighter) +} + +.md-banner strong { + white-space: nowrap +} + +.md-banner a, +.md-banner strong { + color: var(--md-footer-fg-color) +} + +.md-banner a:focus, +.md-banner a:hover { + color: currentcolor +} + +.md-banner a:focus .twemoji, +.md-banner a:hover .twemoji { + background-color: var(--md-footer-fg-color); + box-shadow: none +} + +.md-banner .twemoji { + border-radius: 100%; + box-shadow: inset 0 0 0 .05rem currentcolor; + display: inline-block; + height: 1.2rem; + padding: .25rem; + transition: all .25s; + vertical-align: bottom; + width: 1.2rem +} + +.md-banner .twemoji svg { + display: block; + max-height: none +} + +/* annotation buttons' pulse animation */ +a.md-annotation__index { + border-radius: 2.2ch; +} + +@keyframes pulse { + 0% { + box-shadow: 0 0 0 0 var(--md-accent-fg-color); + transform: scale(.95) + } + + 75% { + box-shadow: 0 0 0 .625em transparent; + transform: scale(1) + } + + to { + box-shadow: 0 0 0 0 transparent; + transform: scale(.95) + } +} diff --git a/docs/gen_cli_doc.py b/docs/gen_cli_doc.py new file mode 100644 index 0000000..3378cf5 --- /dev/null +++ b/docs/gen_cli_doc.py @@ -0,0 +1,36 @@ +from pathlib import Path +from typing import Dict, Any +import yaml +import mkdocs_gen_files +from cli_gen import generate_cli_doc + +FILENAME = "cli.md" + +VERSION_DISCLAIMER = """ +!!! quote "v1.x vs v2.x" + + - v1.x was written in pure python + - v2.x was written in rust (with python and node.js bindings) + + Version 2.x is intended to be backwards compatible, but a complete + rewrite in rust prompted a major version bump. + + The minimum versions (badges) specified here hyperlink to different repositories. + Anything established in v2.x will correspond to the rust project. + Anything established in v1.4.6 or later (before v2.0.0) will correspond to the pure + python project. Anything established before v1.4.6 will correspond to pure python + sources in the cpp-linter-action project. + +""" + +with mkdocs_gen_files.open(FILENAME, "w") as io_doc: + options_versions = Path(__file__).parent / "cli.yml" + versions: Dict[str, Any] = yaml.safe_load(options_versions.read_bytes()) + + print("# Command Line Interface\n", file=io_doc) + print(VERSION_DISCLAIMER, file=io_doc) + doc = generate_cli_doc(versions["inputs"]) + # print(doc) + print(doc, file=io_doc) + +mkdocs_gen_files.set_edit_path(FILENAME, "gen_cli_doc.py") diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml new file mode 100644 index 0000000..a968d56 --- /dev/null +++ b/docs/mkdocs.yml @@ -0,0 +1,104 @@ +site_name: Cpp-Linter +site_description: "Documentation for the cpp-linter package." +site_url: "https://cpp-linter.github.io/cpp-linter-rs" +repo_url: "https://github.com/cpp-linter/cpp-linter-rs" +repo_name: "cpp-linter/cpp-linter-rs" +edit_uri: "edit/main/docs/docs/" +nav: + - index.md + - cli.md + - pr-review-caveats.md + - permissions.md + - python.md + - node.md + - changelog.md + +theme: + name: material + features: + - navigation.top + - content.tabs.link + - content.tooltips + - content.code.annotate + - content.code.copy + - content.action.view + - content.action.edit + - navigation.footer + - search.suggest + - search.share + - navigation.tracking + - toc.follow + logo: images/logo.png + favicon: images/favicon.ico + icon: + repo: fontawesome/brands/github + palette: + # Palette toggle for automatic mode + - media: "(prefers-color-scheme)" + primary: blue + accent: cyan + toggle: + icon: material/brightness-auto + name: Switch to light mode + + # Palette toggle for light mode + - media: "(prefers-color-scheme: light)" + scheme: default + primary: blue + accent: cyan + toggle: + icon: material/lightbulb-outline + name: Switch to dark mode + + # Palette toggle for dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: blue + accent: cyan + toggle: + icon: material/lightbulb + name: Switch to system preference +extra: + social: + - icon: fontawesome/brands/github + link: https://github.com/cpp-linter/cpp-linter + - icon: fontawesome/brands/python + link: https://pypi.org/project/cpp-linter/ + - icon: fontawesome/brands/npm + link: https://www.npmjs.com/package/@cpp-linter/cpp-linter + - icon: simple/rust + link: https://crates.io/crates/cpp-linter + +extra_css: + - stylesheets/extra.css + +plugins: + - search + - include-markdown + - gen-files: + scripts: + - gen_cli_doc.py + +markdown_extensions: + - pymdownx.superfences + - pymdownx.tabbed: + alternate_style: true + - pymdownx.emoji: + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg + - toc: + permalink: true + - pymdownx.highlight: + linenums_style: pymdownx-inline + - pymdownx.inlinehilite + - pymdownx.snippets: + check_paths: true + - pymdownx.tasklist: + custom_checkbox: true + - attr_list + - admonition + - markdown_gfm_admonition + +# Hooks +hooks: + - badge_hook.py diff --git a/docs/pyproject.toml b/docs/pyproject.toml new file mode 100644 index 0000000..d2a7da3 --- /dev/null +++ b/docs/pyproject.toml @@ -0,0 +1,17 @@ +[build-system] +requires = ["maturin>=1.4,<2.0"] +build-backend = "maturin" + +[project] +name = "cli-gen" +description = "Generate cpp-linter CLI doc from rust src." +version = "0.0.0" +readme = "README.md" +license = {text = "MIT License"} +requires-python = ">=3.7" +authors = [ + { name = "Brendan Doherty", email = "2bndy5@gmail.com" }, +] + +[tool.maturin] +features = ["pyo3/extension-module"] diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..9024916 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,6 @@ +markdown-gfm-admonition==0.1.1 +mkdocs==1.6.1 +mkdocs-gen-files==0.5.0 +mkdocs-include-markdown-plugin==6.2.2 +mkdocs-material==9.5.39 +pyyaml==6.0.2 diff --git a/docs/src/CHANGELOG.md b/docs/src/CHANGELOG.md deleted file mode 100644 index ce53563..0000000 --- a/docs/src/CHANGELOG.md +++ /dev/null @@ -1,3 +0,0 @@ - - -{{#include ../../CHANGELOG.md}} diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md deleted file mode 100644 index c240a27..0000000 --- a/docs/src/SUMMARY.md +++ /dev/null @@ -1,11 +0,0 @@ -# Summary - - - -- [Introduction](./index.md) -- [Command Line Interface](./cli.md) -- [Token Permissions](./permissions.md) -- [Pull Request Review Caveats](./pr-review-caveats.md) -- [Python Binding](./python.md) -- [Node.js Binding](./node.md) -- [Change Log](./CHANGELOG.md) diff --git a/docs/src/lib.rs b/docs/src/lib.rs new file mode 100644 index 0000000..20e0cce --- /dev/null +++ b/docs/src/lib.rs @@ -0,0 +1,125 @@ +//! This exposes a function in Python, so an mkdocs plugin can use it to generate the CLI document. +//! For actual library/binary source code look in cpp-linter folder. +use std::collections::HashMap; + +use cpp_linter::cli; +use pyo3::{exceptions::PyValueError, prelude::*}; + +const GROUPS_ORDER: [&str; 5] = [ + "General options", + "Source options", + "Clang-format options", + "Clang-tidy options", + "Feedback options", +]; + +#[pyfunction] +fn generate_cli_doc(metadata: HashMap>>) -> PyResult { + let mut out = String::new(); + let mut command = cli::get_arg_parser(); + out.push_str( + format!( + "```text title=\"Usage\"\n{}\n```\n", + command + .render_usage() + .to_string() + .trim_start_matches("Usage: ") + ) + .as_str(), + ); + + out.push_str("\n## Commands\n"); + for cmd in command.get_subcommands() { + out.push_str(format!("\n### `{}`\n\n", cmd.get_name()).as_str()); + out.push_str( + format!( + "{}\n", + &cmd.get_about() + .ok_or(PyValueError::new_err(format!( + "{} command has no help message", + cmd.get_name() + )))? + .to_string() + .trim() + ) + .as_str(), + ); + } + + out.push_str("## Arguments\n"); + for arg in command.get_positionals() { + out.push_str(format!("\n### `{}`\n\n", arg.get_id().as_str()).as_str()); + if let Some(help) = arg.get_help() { + out.push_str(format!("{}\n", help.to_string().trim()).as_str()); + } + } + + // reorganize groups according to GROUPS_ORDER + let mut ordered = Vec::with_capacity(command.get_groups().count()); + for group in GROUPS_ORDER { + let group_obj = command + .get_groups() + .find(|arg_group| arg_group.get_id().as_str() == group) + .ok_or(PyValueError::new_err(format!( + "{} not found in command's groups", + group + )))?; + ordered.push(group_obj.to_owned()); + } + + for group in ordered { + out.push_str(format!("\n## {}\n", group.get_id()).as_str()); + for arg_id in group.get_args() { + let arg = command + .get_arguments() + .find(|a| *a.get_id() == *arg_id) + .ok_or(PyValueError::new_err(format!( + "arg {} in group {} not found in command", + arg_id.as_str(), + group.get_id().as_str() + )))?; + let long_name = arg.get_long().ok_or(PyValueError::new_err(format!( + "Failed to get long name of argument with id {}", + arg_id.as_str() + )))?; + out.push_str( + format!( + "\n### `-{}, --{}`\n\n", + arg.get_short().ok_or(PyValueError::new_err(format!( + "Failed to get short name for argument with id {}", + arg_id.as_str() + )))?, + long_name + ) + .as_str(), + ); + if let Some(map) = metadata.get(long_name) { + if let Some(val) = map.get("minimum-version") { + out.push_str(format!("\n", val).as_str()); + } + if let Some(val) = map.get("required-permission") { + out.push_str(format!("\n", val).as_str()); + } + if map.contains_key("experimental") { + out.push_str("\n"); + } + } + let default = arg.get_default_values(); + if let Some(default_value) = default.first() { + out.push_str(format!("\n\n", default_value).as_str()); + } else { + out.push('\n'); + } + if let Some(help) = &arg.get_help() { + out.push_str(format!("{}\n", help.to_string().trim()).as_str()); + } + } + } + Ok(out) +} + +#[pymodule] +pub fn cli_gen(m: &Bound<'_, PyModule>) -> PyResult<()> { + m.add_function(wrap_pyfunction!(generate_cli_doc, m)?)?; + Ok(()) +} diff --git a/docs/src/main.rs b/docs/src/main.rs deleted file mode 100644 index fcd99af..0000000 --- a/docs/src/main.rs +++ /dev/null @@ -1,203 +0,0 @@ -//! This is a preprocessor for mdbook that generates the CLI document. -//! For actual library/binary source code look in cpp-linter folder. - -extern crate clap; -use clap::{Arg, ArgMatches, Command}; -extern crate mdbook; -use mdbook::errors::Error; -use mdbook::preprocess::{CmdPreprocessor, Preprocessor}; -extern crate semver; -extern crate serde_json; -use semver::{Version, VersionReq}; -use std::io; -use std::process; - -extern crate cpp_linter; - -use cli_gen_lib::CliGen; - -pub fn make_app() -> Command { - Command::new("cli-gen") - .about("A mdbook preprocessor which generates a doc of CLI options") - .subcommand( - Command::new("supports") - .arg(Arg::new("renderer").required(true)) - .about("Check whether a renderer is supported by this preprocessor"), - ) -} - -fn handle_preprocessing(pre: &dyn Preprocessor) -> Result<(), Error> { - let (ctx, book) = CmdPreprocessor::parse_input(io::stdin())?; - - let book_version = Version::parse(&ctx.mdbook_version)?; - let version_req = VersionReq::parse(mdbook::MDBOOK_VERSION)?; - - if !version_req.matches(&book_version) { - eprintln!( - "Warning: The {} plugin was built against version {} of mdbook, \ - but we're being called from version {}", - pre.name(), - mdbook::MDBOOK_VERSION, - ctx.mdbook_version - ); - } - - let processed_book = pre.run(&ctx, book)?; - serde_json::to_writer(io::stdout(), &processed_book)?; - - Ok(()) -} - -fn handle_supports(pre: &dyn Preprocessor, sub_args: &ArgMatches) -> ! { - let renderer = sub_args - .get_one::("renderer") - .expect("Required argument"); - let supported = pre.supports_renderer(renderer); - - // Signal whether the renderer is supported by exiting with 1 or 0. - if supported { - process::exit(0); - } else { - process::exit(1); - } -} - -fn main() { - let matches = make_app().get_matches(); - - // Users will want to construct their own preprocessor here - let preprocessor = CliGen {}; - - if let Some(sub_args) = matches.subcommand_matches("supports") { - handle_supports(&preprocessor, sub_args); - } else if let Err(e) = handle_preprocessing(&preprocessor) { - eprintln!("{}", e); - process::exit(1); - } -} - -mod cli_gen_lib { - use std::path::PathBuf; - - use mdbook::book::Book; - use mdbook::preprocess::{Preprocessor, PreprocessorContext}; - - use cpp_linter::cli; - - pub struct CliGen; - - impl CliGen { - fn generate_cli(groups_order: &Option>) -> String { - let mut out = String::new(); - let command = cli::get_arg_parser(); - out.push_str(format!("\n{}\n\n", "# Command Line Interface").as_str()); - out.push_str("\n"); - out.push_str("\n## Commands\n"); - for cmd in command.get_subcommands() { - out.push_str(format!("\n### `{}`\n\n", cmd.get_name()).as_str()); - out.push_str( - format!("{}\n", &cmd.get_about().unwrap().to_string().trim()).as_str(), - ); - } - out.push_str("## Arguments\n"); - for arg in command.get_positionals() { - out.push_str(format!("\n### `{}`\n\n", arg.get_id().as_str()).as_str()); - if let Some(help) = arg.get_help() { - out.push_str(format!("{}\n", help.to_string().trim()).as_str()); - } - } - let arg_groups = if let Some(groups) = groups_order { - eprintln!("ordering groups into {:?}", groups); - let mut ordered = Vec::with_capacity(command.get_groups().count()); - for group in groups { - let mut group_obj = None; - for arg_group in command.get_groups() { - if arg_group.get_id().as_str() == group.as_str() { - group_obj = Some(arg_group.clone()); - } - } - ordered.push( - group_obj - .unwrap_or_else(|| panic!("{} not found in command's groups", group)), - ); - } - ordered - } else { - command.get_groups().map(|g| g.to_owned()).collect() - }; - for group in arg_groups { - out.push_str(format!("\n## {}\n", group.get_id()).as_str()); - for arg_id in group.get_args() { - let mut arg_match = command.get_arguments().filter(|a| *a.get_id() == *arg_id); - let arg = arg_match.next().unwrap_or_else(|| { - panic!( - "arg {} expected in group {}", - arg_id.as_str(), - group.get_id().as_str() - ) - }); - out.push_str( - format!( - "\n### `-{}, --{}`\n\n", - &arg.get_short().unwrap(), - &arg.get_long().unwrap() - ) - .as_str(), - ); - let default = arg.get_default_values(); - if !default.is_empty() { - out.push_str("
Default
"); - assert_eq!(default.len(), 1); - out.push_str( - format!("{:?}
\n\n", default.first().unwrap()) - .as_str(), - ); - } - if let Some(help) = &arg.get_help() { - out.push_str(format!("{}\n", help.to_string().trim()).as_str()); - } - } - } - out - } - } - - impl Preprocessor for CliGen { - fn name(&self) -> &str { - "cli-gen" - } - - fn run(&self, ctx: &PreprocessorContext, book: Book) -> mdbook::errors::Result { - let mut altered = book.clone(); - let groups_order = match ctx - .config - .get_preprocessor("cli-gen") - .unwrap() - .get("groups-order") - { - Some(val) => val.clone().as_array_mut().map(|v| { - v.iter_mut() - .map(|o| o.to_string().trim_matches('"').to_string()) - .collect() - }), - None => None, - }; - altered.for_each_mut(|item| { - if let mdbook::BookItem::Chapter(chap) = item { - if chap - .path - .clone() - .is_some_and(|p| p == PathBuf::from("cli.md")) - { - chap.content = CliGen::generate_cli(&groups_order); - } - } - }); - Ok(altered) - } - - fn supports_renderer(&self, renderer: &str) -> bool { - matches!(renderer, "html" | "markdown") - } - } -} diff --git a/docs/src/node.md b/docs/src/node.md deleted file mode 100644 index 2423e30..0000000 --- a/docs/src/node.md +++ /dev/null @@ -1,3 +0,0 @@ -# Node.js Binding - -{{#include ../../node-binding/README.md:2:}} diff --git a/docs/src/python.md b/docs/src/python.md deleted file mode 100644 index 870ca3e..0000000 --- a/docs/src/python.md +++ /dev/null @@ -1,3 +0,0 @@ -# Python Binding - -{{#include ../../py-binding/README.md:2:}} diff --git a/docs/theme/pagetoc.css b/docs/theme/pagetoc.css deleted file mode 100644 index eff428b..0000000 --- a/docs/theme/pagetoc.css +++ /dev/null @@ -1,63 +0,0 @@ -@media only screen { - main { - position: relative; - } - - .sidetoc { - margin-left: auto; - margin-right: auto; - } - - .pagetoc { - width: auto; - word-wrap: normal; - } - - .pagetoc a { - color: var(--sidebar-fg) !important; - display: block; - padding-left: 10px; - text-align: left; - text-decoration: none; - margin-block-start: 0.6em; - } - - .pagetoc a:hover, - .pagetoc a.active { - color: var(--sidebar-active) !important; - } - - .pagetoc .active { - color: var(--sidebar-active); - } - - .pagetoc .pagetoc-H2 { - padding-left: 20px; - } - - .pagetoc .pagetoc-H3 { - padding-left: 40px; - } - - .pagetoc .pagetoc-H4 { - padding-left: 60px; - } - - .pagetoc .pagetoc-H5 { - display: none; - } - - .pagetoc .pagetoc-H6 { - display: none; - } - - ol.chapter a { - color: var(--sidebar-fg); - text-decoration: none; - } - - ol.chapter a.active { - color: var(--sidebar-active); - text-decoration: none; - } -} diff --git a/docs/theme/pagetoc.js b/docs/theme/pagetoc.js deleted file mode 100644 index a9d7a91..0000000 --- a/docs/theme/pagetoc.js +++ /dev/null @@ -1,99 +0,0 @@ -let scrollTimeout; - -const listenActive = () => { - const elems = document.querySelector(".pagetoc").children; - [...elems].forEach((el) => { - el.addEventListener("click", () => { - clearTimeout(scrollTimeout); - [...elems].forEach((el) => el.classList.remove("active")); - el.classList.add("active"); - // Prevent scroll updates for a short period - // eslint-disable-next-line no-async-operation - scrollTimeout = setTimeout(() => { - scrollTimeout = null; - }, 100); // Adjust timing as needed - }); - }); -}; - -const getPagetoc = () => { - return document.querySelector(".pagetoc") || autoCreatePagetoc(); -}; - -const autoCreatePagetoc = () => { - const chapter = document.querySelector( - "body nav#sidebar.sidebar li.chapter-item.expanded a.active" - ); - const content = Object.assign(document.createElement("div"), { - className: "content-wrap", - }); - content.appendChild(chapter.cloneNode(true)); - const divAddedToc = Object.assign(document.createElement("div"), { - className: "sidetoc", - }); - const navAddedToc = Object.assign(document.createElement("nav"), { - className: "pagetoc", - }); - divAddedToc.appendChild(navAddedToc); - content.appendChild(divAddedToc); - chapter.replaceWith(content); - return document.querySelector(".pagetoc"); -}; - -const updateFunction = () => { - if (scrollTimeout) return; // Skip updates if within the cooldown period from a click - const headers = [...document.getElementsByClassName("header")]; - const scrolledY = window.scrollY; - - // Find the last header that is above the current scroll position - let headerOffsets = headers.filter((el) => scrolledY >= el.offsetTop); - const lastHeader = headerOffsets.reverse().shift(); - - const pagetocLinks = [...document.querySelector(".pagetoc").children]; - pagetocLinks.forEach((link) => link.classList.remove("active")); - - if (lastHeader) { - const activeLink = pagetocLinks.find( - (link) => lastHeader.href === link.href - ); - if (activeLink) activeLink.classList.add("active"); - } -}; -function getHeaderText(header) { - let text = header.textContent; - if (text === "") { - let sibling = header.nextSibling; - let maxIterations = 100; - while (sibling != null && maxIterations > 0) { - text += sibling.textContent; - sibling = sibling.nextSibling; - maxIterations--; - } - if (maxIterations === 0) { - console.warn( - "Possible circular reference in DOM when extracting header text" - ); - } - } - return text; -} - -const onLoad = () => { - const pagetoc = getPagetoc(); - var headers = [...document.getElementsByClassName("header")]; - headers.shift(); - headers.forEach((header) => { - const text = getHeaderText(header); - const link = Object.assign(document.createElement("a"), { - textContent: text, - href: header.href, - className: `pagetoc-${header.parentElement.tagName}`, - }); - pagetoc.appendChild(link); - }); - updateFunction(); - listenActive(); - window.addEventListener("scroll", updateFunction); -}; - -window.addEventListener("load", onLoad); diff --git a/justfile b/justfile index 000d796..1601b35 100644 --- a/justfile +++ b/justfile @@ -34,12 +34,12 @@ lcov: # serve docs [group("docs")] docs open='': - mdbook serve docs {{ open }} + mkdocs serve --config-file docs/mkdocs.yml {{ open }} # build docs [group("docs")] -docs-build open='': - mdbook build docs {{ open }} +docs-build: + mkdocs build --config-file docs/mkdocs.yml # rust docs [group("docs")] diff --git a/node-binding/README.md b/node-binding/README.md index a71f6bd..2452c35 100644 --- a/node-binding/README.md +++ b/node-binding/README.md @@ -1,5 +1,5 @@ # cpp-linter - + The node.js binding for the [cpp-linter-rs][this] rust project (built using [napi-rs](https://napi.rs) and [yarn](https://yarnpkg.com)). diff --git a/py-binding/README.md b/py-binding/README.md index 2eacd73..45fcb59 100644 --- a/py-binding/README.md +++ b/py-binding/README.md @@ -1,5 +1,5 @@ # cpp-linter - + The python binding for the [cpp-linter-rs][this] rust project (built using [pyo3](https://pyo3.rs) and [maturin]).