Repository: dynaconf/dynaconf

Issue:
[RFC] Add a dynaconf show command to view a single setting
**Is your feature request related to a problem? Please describe.**
It would be nice to have a `dynconf show` command to display information for a single setting.

**Describe the solution you'd like**
```
$ dynaconf show MEDIA_ROOT
Name: MEDIA_ROOT
Type: str
Value: /var/lib/dynaconf/media
Location: /etc/dynaconf/settings.toml
...
```


Discussion:
similar or duplicate of? #650 
Right you can do `dynaconf list -k MEDIA_ROOT`  but is coming with formatting, we want to also add a raw option to output the pure value allowing

```
export FOO=$(dynaconf get MEDIA_ROOT)
```
Yea, thank you. I'll close this as a dupe.

Resolving patch:
diff --git a/dynaconf/cli.py b/dynaconf/cli.py
--- a/dynaconf/cli.py
+++ b/dynaconf/cli.py
@@ -18,6 +18,7 @@
 from dynaconf.utils.files import read_file
 from dynaconf.utils.functional import empty
 from dynaconf.utils.parse_conf import parse_conf_data
+from dynaconf.utils.parse_conf import unparse_conf_data
 from dynaconf.validator import ValidationError
 from dynaconf.validator import Validator
 from dynaconf.vendor import click
@@ -402,6 +403,45 @@ def init(ctx, fileformat, path, env, _vars, _secrets, wg, y, django):
         )
 
 
+@main.command(name="get")
+@click.argument("key", required=True)
+@click.option(
+    "--default",
+    "-d",
+    default=empty,
+    help="Default value if settings doesn't exist",
+)
+@click.option(
+    "--env", "-e", default=None, help="Filters the env to get the values"
+)
+@click.option(
+    "--unparse",
+    "-u",
+    default=False,
+    help="Unparse data by adding markers such as @none, @int etc..",
+    is_flag=True,
+)
+def get(key, default, env, unparse):
+    """Returns the raw value for a settings key"""
+    if env:
+        env = env.strip()
+    if key:
+        key = key.strip()
+
+    if env:
+        settings.setenv(env)
+
+    if default is not empty:
+        result = settings.get(key, default)
+    else:
+        result = settings[key]  # let the keyerror raises
+
+    if unparse:
+        result = unparse_conf_data(result)
+
+    click.echo(result, nl=False)
+
+
 @main.command(name="list")
 @click.option(
     "--env", "-e", default=None, help="Filters the env to get the values"


Test patch:
diff --git a/tests/test_cli.py b/tests/test_cli.py
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -111,6 +111,85 @@ def test_list(testdir):
     assert "TEST_KEY<str> 'test_value'" in result
 
 
+def test_get(testdir):
+    """Tests get command"""
+    result = run(
+        ["get", "TEST_KEY"],
+        env={
+            "ROOT_PATH_FOR_DYNACONF": testdir,
+            "INSTANCE_FOR_DYNACONF": "tests.config.settings",
+        },
+    )
+    assert result == "test_value"
+
+
+def test_get_lower(testdir):
+    """Tests get command"""
+    result = run(
+        ["get", "test_key"],
+        env={
+            "ROOT_PATH_FOR_DYNACONF": testdir,
+            "INSTANCE_FOR_DYNACONF": "tests.config.settings",
+        },
+    )
+    assert result == "test_value"
+
+
+def test_get_unparsed(testdir):
+    """Tests get command"""
+    result = run(
+        ["get", "COMMENTJSON_ENABLED_FOR_DYNACONF", "-u"],
+        env={
+            "ROOT_PATH_FOR_DYNACONF": testdir,
+            "INSTANCE_FOR_DYNACONF": "tests.config.settings",
+        },
+    )
+    assert result == "@bool False"
+
+
+def test_get_with_default(testdir):
+    """Tests get command"""
+    result = run(
+        ["get", "this_obviously_doesnt_exist_yet", "-d", "Hello123"],
+        env={
+            "ROOT_PATH_FOR_DYNACONF": testdir,
+            "INSTANCE_FOR_DYNACONF": "tests.config.settings",
+        },
+    )
+    assert result == "Hello123"
+
+
+def test_get_other_env(tmpdir):
+    """Tests get command"""
+    settings_file = tmpdir.join("settings.json")
+    settings_file.write(
+        '{"prod": {"name": "admin"}, "development": {"name": "dev"}}'
+    )
+    instance_file = tmpdir.join("myconfig.py")
+    instance_file.write(
+        "settings = __import__('dynaconf').Dynaconf("
+        f"settings_file=r'{str(settings_file)}',"
+        "environments=True"
+        ")"
+    )
+
+    result = run(
+        ["get", "name"],
+        env={
+            "INSTANCE_FOR_DYNACONF": "myconfig.settings",
+        },
+    )
+    assert result == "dev"
+
+    result = run(
+        ["get", "name", "-e", "prod"],
+        env={
+            "INSTANCE_FOR_DYNACONF": "myconfig.settings",
+        },
+    )
+    assert result == "admin"
+
+
 def test_help_dont_require_instance(testdir):
     result = os.system("dynaconf list --help")
     assert result == 0