Repository: cogeotiff/rio-cogeo

Issue:
set  case_insensitive=True on the click.option
```
Error: Invalid value for '--cog-profile' / '-p': invalid choice: WEBP. (choose from jpeg, webp, zstd, lzw, deflate, packbits, lzma, lerc, lerc_deflate, lerc_zstd, raw)
```

cc @kylebarron

Discussion:

Patch:
diff --git a/rio_cogeo/profiles.py b/rio_cogeo/profiles.py
index 9a91747..15e7c9f 100644
--- a/rio_cogeo/profiles.py
+++ b/rio_cogeo/profiles.py
@@ -174,6 +174,7 @@ class COGProfiles(dict):
 
     def get(self, key):
         """Like normal item access but error."""
+        key = key.lower()
         if key not in (self.keys()):
             raise KeyError("{} is not a valid COG profile name".format(key))
 
diff --git a/rio_cogeo/scripts/cli.py b/rio_cogeo/scripts/cli.py
index 9b1e486..f28b102 100644
--- a/rio_cogeo/scripts/cli.py
+++ b/rio_cogeo/scripts/cli.py
@@ -83,7 +83,7 @@ def cogeo():
     "--cog-profile",
     "-p",
     "cogeo_profile",
-    type=click.Choice(cog_profiles.keys()),
+    type=click.Choice(cog_profiles.keys(), case_sensitive=False),
     default="deflate",
     help="CloudOptimized GeoTIFF profile (default: deflate).",
 )


Test patch:
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 5e87e19..819e345 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -458,3 +458,16 @@ def test_cogeo_validate(runner):
         assert "is NOT a valid cloud optimized GeoTIFF" in result.output
         assert not result.exception
         assert result.exit_code == 0
+
+
+def test_cogeo_validUpercaseProfile(monkeypatch, runner):
+    """Should work as expected."""
+    with runner.isolated_filesystem():
+        result = runner.invoke(
+            cogeo,
+            ["create", raster_path_rgb, "output.tif", "--cog-profile", "DEFLATE"],
+        )
+        assert not result.exception
+        assert result.exit_code == 0
+        with rasterio.open("output.tif") as src:
+            assert src.compression.value == "DEFLATE"
diff --git a/tests/test_profile.py b/tests/test_profile.py
index 1aa567a..a4c40ed 100644
--- a/tests/test_profile.py
+++ b/tests/test_profile.py
@@ -15,6 +15,9 @@ def test_profiles_jpeg():
     assert profile["photometric"] == "YCbCr"
     assert profile["interleave"] == "pixel"
 
+    profile = cog_profiles.get("JPEG")
+    assert profile["compress"] == "JPEG"
+
 
 def test_profiles_webp():
     """Should work as expected (return webp profile)."""