Skip to content
This repository has been archived by the owner on Nov 16, 2024. It is now read-only.

Commit

Permalink
add “Adding a Vision feature“ section to contributing
Browse files Browse the repository at this point in the history
  • Loading branch information
Edoardo La Greca committed Mar 18, 2024
1 parent 624b278 commit 0d18b42
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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`).

0 comments on commit 0d18b42

Please sign in to comment.