From 988344ddaa175285ac33587a65106af7b30a262d Mon Sep 17 00:00:00 2001 From: Elias Ram Date: Thu, 16 May 2024 15:10:06 +0200 Subject: [PATCH] docs(commands): Add info about clap Derive API --- CONTRIBUTING.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 493a960be8..3dead760c5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,12 @@ +# Adding new commands +For new commands, it is recommended to use clap's [Derive API](https://docs.rs/clap/latest/clap/_derive/index.html). +In contrast to the [Builder API](https://docs.rs/clap/latest/clap/_tutorial/index.html), the Derive API makes it: +- Easier to read, write, and modify commands and arguments. +- Easier to keep argument declaration and reading in sync. +- Easier to reuse shared arguments. + +An existing example of how to use the Derive API is the `send-metric` command. + # Integration Tests Integration tests are written using `trycmd` crate. Consult the docs in case you need to understand how it works https://docs.rs/trycmd/latest/trycmd/.