Repository: tellor-io/telliot-feeds (language: python)

Issue:
Make commands for adding chained accounts
The user should be able to add, update, delete chained account using the `telliot` cli instead of having to use a separate one (`chained`). Everything in one place..


Discussion / hints:
Relevant: https://github.com/pydefi/chained-accounts/blob/main/src/chained_accounts/cli.py
Good idea

Fix patch:
diff --git a/src/telliot_feeds/cli/commands/account.py b/src/telliot_feeds/cli/commands/account.py
new file mode 100644
index 00000000..7531b029
--- /dev/null
+++ b/src/telliot_feeds/cli/commands/account.py
@@ -0,0 +1,16 @@
+import click
+from chained_accounts.cli import add as chained_accounts_add
+from chained_accounts.cli import delete as chained_accounts_delete
+from chained_accounts.cli import find as chained_accounts_find
+from chained_accounts.cli import key as chained_accounts_key
+
+
+@click.group()
+def account() -> None:
+    """Create, find, and manage accounts."""
+
+
+account.add_command(chained_accounts_add)
+account.add_command(chained_accounts_find)
+account.add_command(chained_accounts_key)
+account.add_command(chained_accounts_delete)
diff --git a/src/telliot_feeds/cli/main.py b/src/telliot_feeds/cli/main.py
index 460e1990..1028fffa 100644
--- a/src/telliot_feeds/cli/main.py
+++ b/src/telliot_feeds/cli/main.py
@@ -8,6 +8,7 @@
 from chained_accounts import find_accounts
 from click.core import Context
 
+from telliot_feeds.cli.commands.account import account
 from telliot_feeds.cli.commands.catalog import catalog
 from telliot_feeds.cli.commands.config import config
 from telliot_feeds.cli.commands.integrations import integrations
@@ -69,6 +70,7 @@ def main(
 main.add_command(settle)
 main.add_command(integrations)
 main.add_command(config)
+main.add_command(account)
 
 if __name__ == "__main__":
     main()


Test patch:
diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.py
index 335a91ec..99d18287 100644
--- a/tests/cli/test_cli.py
+++ b/tests/cli/test_cli.py
@@ -185,3 +185,16 @@ def test_config_cmd():
     result = runner.invoke(cli_main, ["config", "init"])
     assert not result.exception
     print(result.stdout)
+
+
+def test_account_cmd():
+    """Test command: account."""
+    runner = CliRunner()
+    result = runner.invoke(cli_main, ["account", "--help"])
+    msg = result.stdout.lower()
+
+    assert not result.exception
+    assert "find" in msg
+    assert "create" in msg
+    assert "key" in msg
+    assert "delete" in msg