From 58c2fcbd0472e9de35df4e79d459472a7e3637df Mon Sep 17 00:00:00 2001
From: holgern <holgernahrstaedt@gmx.de>
Date: Tue, 7 Apr 2020 08:57:56 +0200
Subject: [PATCH] add click_shell

* add click_shell to turn beempy into a shell utility with autocompletion
* new click_shell added as requirements
---
 .travis.yml                 | 2 +-
 CHANGELOG.rst               | 5 +++++
 appveyor.yml                | 2 +-
 beem/cli.py                 | 5 +++--
 beem/imageuploader.py       | 2 +-
 beem/version.py             | 2 +-
 beemapi/version.py          | 2 +-
 beembase/version.py         | 2 +-
 beemgraphenebase/version.py | 2 +-
 requirements-test.txt       | 1 +
 setup.py                    | 3 ++-
 11 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 7d4d41f3..2832a202 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -59,7 +59,7 @@ before_install:
   # Set numpy version first, other packages link against it
   - pip install six nose coverage codecov pytest pytest-cov coveralls codacy-coverage parameterized secp256k1prp cryptography scrypt
   - pip install pycryptodomex  pyyaml appdirs pylibscrypt tox
-  - pip install ecdsa requests future websocket-client pytz six Click events prettytable
+  - pip install ecdsa requests future websocket-client pytz six Click events prettytable click_shell
 
 script:
  - tox
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 00ed6509..5f3b6a48 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,5 +1,10 @@
 Changelog
 =========
+0.22.14
+-------
+* add click_shell to turn beempy into a shell utility with autocompletion
+* new click_shell added as requirements
+
 0.22.13
 -------
 * HiveSigner support added
diff --git a/appveyor.yml b/appveyor.yml
index 49219136..6058f3ec 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -50,7 +50,7 @@ install:
 - cmd: conda install --yes conda-build setuptools pip parameterized cryptography
 - cmd: conda install --yes pycryptodomex pyyaml pytest pytest-mock coverage mock appdirs pylibscrypt
 - cmd: pip install scrypt -U
-- cmd: conda install --yes ecdsa requests future websocket-client pytz six Click events prettytable pyinstaller
+- cmd: conda install --yes ecdsa requests future websocket-client pytz six Click events prettytable pyinstaller click_shell
 
 
 build_script:
diff --git a/beem/cli.py b/beem/cli.py
index 2a3109ce..40582d13 100644
--- a/beem/cli.py
+++ b/beem/cli.py
@@ -17,6 +17,7 @@ import math
 import random
 import logging
 import click
+from click_shell import shell
 import yaml
 import re
 from beem.instance import set_shared_steem_instance, shared_steem_instance
@@ -152,8 +153,8 @@ def node_answer_time(node):
         rpc_answer_time = float("inf")
     return rpc_answer_time
 
-
-@click.group(chain=True)
+@shell(prompt='beempy> ', intro='Starting beempy... (use help to list all commands)', chain=True)
+# @click.group(chain=True)
 @click.option(
     '--node', '-n', default="", help="URL for public Steem API (e.g. https://api.steemit.com)")
 @click.option(
diff --git a/beem/imageuploader.py b/beem/imageuploader.py
index ba7cc08b..c80122eb 100644
--- a/beem/imageuploader.py
+++ b/beem/imageuploader.py
@@ -28,7 +28,7 @@ class ImageUploader(object):
         self.base_url = base_url
         self.steem = steem_instance or shared_steem_instance()
         if self.steem.is_hive and base_url == "https://steemitimages.com":
-            base_url = "https://images.hive.blog"
+            self.base_url = "https://images.hive.blog"
 
     def upload(self, image, account, image_name=None):
         """ Uploads an image
diff --git a/beem/version.py b/beem/version.py
index 798f229e..b8bc9d9c 100644
--- a/beem/version.py
+++ b/beem/version.py
@@ -1,2 +1,2 @@
 """THIS FILE IS GENERATED FROM beem SETUP.PY."""
-version = '0.22.13'
+version = '0.22.14'
diff --git a/beemapi/version.py b/beemapi/version.py
index 798f229e..b8bc9d9c 100644
--- a/beemapi/version.py
+++ b/beemapi/version.py
@@ -1,2 +1,2 @@
 """THIS FILE IS GENERATED FROM beem SETUP.PY."""
-version = '0.22.13'
+version = '0.22.14'
diff --git a/beembase/version.py b/beembase/version.py
index 798f229e..b8bc9d9c 100644
--- a/beembase/version.py
+++ b/beembase/version.py
@@ -1,2 +1,2 @@
 """THIS FILE IS GENERATED FROM beem SETUP.PY."""
-version = '0.22.13'
+version = '0.22.14'
diff --git a/beemgraphenebase/version.py b/beemgraphenebase/version.py
index 798f229e..b8bc9d9c 100644
--- a/beemgraphenebase/version.py
+++ b/beemgraphenebase/version.py
@@ -1,2 +1,2 @@
 """THIS FILE IS GENERATED FROM beem SETUP.PY."""
-version = '0.22.13'
+version = '0.22.14'
diff --git a/requirements-test.txt b/requirements-test.txt
index 6ebf8bda..e6a98772 100644
--- a/requirements-test.txt
+++ b/requirements-test.txt
@@ -14,6 +14,7 @@ pyyaml>=4.2b1
 mock==4.0.2
 appdirs==1.4.3
 Click==7.1.1
+click_shell>=2.0
 prettytable
 pycodestyle==2.5.0
 pyflakes==2.1.1
diff --git a/setup.py b/setup.py
index 6906ca2b..3b1679cb 100755
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ except LookupError:
     ascii = codecs.lookup('ascii')
     codecs.register(lambda name, enc=ascii: {True: enc}.get(name == 'mbcs'))
 
-VERSION = '0.22.13'
+VERSION = '0.22.14'
 
 tests_require = ['mock >= 2.0.0', 'pytest', 'pytest-mock', 'parameterized']
 
@@ -32,6 +32,7 @@ requires = [
     "pycryptodomex",
     "pytz",
     "Click",
+    "click_shell",
     "prettytable",
     "pyyaml"
 ]
-- 
GitLab