From 0d18b42b39dbabbdf66463153f4076b4a7f99a12 Mon Sep 17 00:00:00 2001 From: Edoardo La Greca Date: Mon, 18 Mar 2024 11:30:53 +0100 Subject: [PATCH] =?UTF-8?q?add=20=E2=80=9CAdding=20a=20Vision=20feature?= =?UTF-8?q?=E2=80=9C=20section=20to=20contributing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CONTRIBUTING.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e69de29..7fe1cba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -0,0 +1,18 @@ +# Contributing + +## Adding a Vision feature + +To add a Google Cloud Vision feature support to Dovelet (both the utility and the library), you need to change two files: `feature.go` and `cmd/dovelet/flag.go`. + +In `feature.go`, you need to: + +1. Add a constant to the `DetectionFeature` enumeration. The new constant must be named after the feature to add. +2. Add a `case` in `DetectionFeature`'s `VisionFeature` function. That new case translates the new constant to its respective Vision-specific value. + +In `cmd/dovelet/flag.go`, you need to: + +1. Add a new boolean field to the `CLArgs` structure. +2. Add a new command line argument in the `ParseArgs` function. To do so: + 1. Create a new variable named after the new feature. Assign the value returned by `f.Bool` to that variable, called with proper argument values. + 2. Assign the variable's value to the new field in the `CLArgs` instance. The value needs to be de-referenced. +3. Add a `case` in `CLArgs`'s `Feature` function. That case maps the new command line argument with the previously added feature (from `feature.go`).