Skip to content

Commit

Permalink
'add "version" to cli commands'
Browse files Browse the repository at this point in the history
  • Loading branch information
faithoflifedev committed Jun 19, 2023
1 parent 5a4c9d9 commit a2e9228
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.8+2

* add "version" to cli commands

## 1.0.8+1

* web entities and pages
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ To use this package, add the dependency to your `pubspec.yaml` file:
```yaml
dependencies:
...
google_vision: ^1.0.8+1
google_vision: ^1.0.8+2
```
### Obtaining Authorization Credentials
Expand Down
42 changes: 36 additions & 6 deletions bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Available commands:
detect Run image detection and annotation for images.
highlight Draw a box to highlight any objects detected.
score For OBJECT_LOCALIZATION, get the score(s) for the object specified with "look-for".
version Display the package name and version |
```

| command | description |
Expand All @@ -49,6 +50,7 @@ Available commands:
| highlight | Draw a box to highlight any objects detected. |
| safe_search | SafeSearch Detection detects explicit content such as adult content or violent content within an image. |
| score | For OBJECT_LOCALIZATION, get the score(s) for the object specified with "look-for". |
| version | Display the package name and version. |

Just like the main library, any responses provided by the above commands will be given in the JSON format. So ideally you will want to use a command line json parser to interpret the results. The recommended json parser for this purpose is [_jq_](https://stedolan.github.io/jq/). With _jq_ you can process the results of a command as follows:

Expand All @@ -59,7 +61,7 @@ Just like the main library, any responses provided by the above commands will be

```sh
# step 1 - setup default default JWT credentials
cp my_credentials.json ~/.vision/credentials.json
mkdir -p ~/.vision; cp my_credentials.json ~/.vision/credentials.json

# step 2
vision highlight --features OBJECT_LOCALIZATION --image-file my_source_image.jpg --output-file result.jpg
Expand All @@ -68,7 +70,10 @@ vision highlight --features OBJECT_LOCALIZATION --image-file my_source_image.jpg
## crop_hints

```sh
prompt>vision crop_hints --help
vision crop_hints --help
```

```text
Set of crop hints that are used to generate new crops when serving images.
Usage: vision crop_hints [arguments]
Expand All @@ -80,7 +85,10 @@ Usage: vision crop_hints [arguments]
## detect

```sh
prompt>vision detect --help
vision detect --help
```

```text
Run image detection and annotation for an images.
Usage: vision detect [arguments]
Expand All @@ -94,7 +102,10 @@ Usage: vision detect [arguments]
## highlight

```sh
prompt>vision highlight --help
vision highlight --help
```

```text
Draw a box to highlight any objects detected.
Usage: vision highlight [arguments]
Expand All @@ -110,7 +121,10 @@ Usage: vision highlight [arguments]
## safe_search

```sh
prompt>vision safe_search --help
vision safe_search --help
```

```text
SafeSearch Detection detects explicit content such as adult content or violent content within an image.
Usage: vision safe_search [arguments]
Expand All @@ -121,7 +135,10 @@ Usage: vision safe_search [arguments]
## score

```sh
prompt>vision score --help
vision score --help
```

```text
For OBJECT_LOCALIZATION, get the score(s) for the object specified with "look-for".
Usage: vision score [arguments]
Expand All @@ -132,3 +149,16 @@ Usage: vision score [arguments]
--max-results=<int> The maxResults parameter specifies the maximum number of items that should be returned in the result set. Acceptable values are 0 to 50, inclusive. The default value is 10.
(defaults to "10")
```

## version

```sh
vision version --help
```

```text
Display the package name and version
Usage: vision version [arguments]
-h, --help Print this usage information.
```
1 change: 1 addition & 0 deletions bin/vision.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ void main(List<String> arguments) async {
..addCommand(VisionHighlightCommand())
..addCommand(VisionSafeSearchCommand())
..addCommand(VisionScoreCommand())
..addCommand(VisionVersionCommand())
..run(arguments).catchError((error) {
if (error is! UsageException) throw error;

Expand Down
1 change: 1 addition & 0 deletions lib/google_vision.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export 'src/cmd/vision_helper_command.dart';
export 'src/cmd/vision_highlight_command.dart';
export 'src/cmd/vision_safe_search_command.dart';
export 'src/cmd/vision_score_command.dart';
export 'src/cmd/vision_version_command.dart';

export 'src/model/annotate_image_response.dart';
export 'src/model/annotated_responses.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/meta.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
import 'dart:convert' show json;

final pubSpec = json.decode(
'{"name":"google_vision","version":"1.0.8+1","homepage":"https://github.com/faithoflifedev/google_vision","environment":{"sdk":">=2.17.0 <4.0.0"},"description":"Allows you to add Google Visions image labeling, face, logo, and landmark detection, OCR, and detection of explicit content, into applications.","dependencies":{"args":"^2.4.2","color":"^3.0.0","crypto_keys":"^0.3.0+1","dio":"^5.2.1+1","http":"^0.13.6","image":"^4.0.17","jose":"^0.3.3","json_annotation":"^4.8.1","retrofit":"^4.0.1","universal_io":"^2.2.2"},"dev_dependencies":{"build_runner":"^2.4.5","grinder":"^0.9.4","json_serializable":"^6.7.0","lints":"^2.1.1","publish_tools":"^0.1.0+10","retrofit_generator":"^7.0.1","test":"^1.24.3"},"executables":{"vision":""},"repository":"https://github.com/faithoflifedev/google_vision"}');
'{"name":"google_vision","version":"1.0.8+2","homepage":"https://github.com/faithoflifedev/google_vision","environment":{"sdk":">=2.17.0 <4.0.0"},"description":"Allows you to add Google Visions image labeling, face, logo, and landmark detection, OCR, and detection of explicit content, into applications.","dependencies":{"args":"^2.4.2","color":"^3.0.0","crypto_keys":"^0.3.0+1","dio":"^5.2.1+1","http":"^0.13.6","image":"^4.0.17","jose":"^0.3.3","json_annotation":"^4.8.1","retrofit":"^4.0.1","universal_io":"^2.2.2"},"dev_dependencies":{"build_runner":"^2.4.5","grinder":"^0.9.4","json_serializable":"^6.7.0","lints":"^2.1.1","publish_tools":"^0.1.0+10","retrofit_generator":"^7.0.1","test":"^1.24.3"},"executables":{"vision":""},"repository":"https://github.com/faithoflifedev/google_vision"}');
15 changes: 15 additions & 0 deletions lib/src/cmd/vision_version_command.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:args/command_runner.dart';
import 'package:google_vision/meta.dart';

class VisionVersionCommand extends Command {
@override
String get description => 'Display the package name and version.';

@override
String get name => 'version';

@override
void run() async {
print('${pubSpec['name']} v${pubSpec['version']}');
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: google_vision
description: Allows you to add Google Visions image labeling, face, logo, and landmark detection, OCR, and detection of explicit content, into applications.
version: 1.0.8+1
version: 1.0.8+2
repository: https://github.com/faithoflifedev/google_vision
homepage: https://github.com/faithoflifedev/google_vision

Expand Down

0 comments on commit a2e9228

Please sign in to comment.