diff --git a/README.md b/README.md
index f98b4d18..e81d3750 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,9 @@
-**The main repository for this software is at https://gitlab.com/beardog/Onionr/**
+**The main repository for this software is at https://GitLab.com/beardog/Onionr/**
+
+**The Github page is a mirror, do not submit PRs or issues there.**
# About
diff --git a/onionr/onionrcommands/parser/__init__.py b/onionr/onionrcommands/parser/__init__.py
index 786e76e3..f988ae15 100644
--- a/onionr/onionrcommands/parser/__init__.py
+++ b/onionr/onionrcommands/parser/__init__.py
@@ -36,7 +36,9 @@ def register_plugin_commands(cmd):
return True
def register():
+ """Registers commands and handles help command processing"""
def get_help_message(cmd: str, default: str = 'No help available for this command'):
+ """Return help message for a given command, supports plugin commands"""
pl_cmd = plugin_command(cmd)
for pl in onionrplugins.get_enabled_plugins():
pl = onionrplugins.get_plugin(pl)
@@ -52,14 +54,16 @@ def register():
return arguments.get_help(cmd)
except AttributeError:
pass
- return default
+ return default # Return the help string
PROGRAM_NAME = "onionr"
+ # Get the command
try:
cmd = sys.argv[1]
except IndexError:
- cmd = ""
+ logger.debug("Detected Onionr run with no commands specified")
+ return
is_help_cmd = False
if cmd.replace('--', '').lower() == 'help': is_help_cmd = True
diff --git a/onionr/tests/test_commands.py b/onionr/tests/test_commands.py
new file mode 100644
index 00000000..7eb6fcae
--- /dev/null
+++ b/onionr/tests/test_commands.py
@@ -0,0 +1,19 @@
+from unittest.mock import patch
+import sys, os
+sys.path.append(".")
+import unittest, uuid
+TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
+print("Test directory:", TEST_DIR)
+os.environ["ONIONR_HOME"] = TEST_DIR
+from onionrcommands import parser
+class OnionrTests(unittest.TestCase):
+ def test_no_command(self):
+ testargs = ["onionr.py"]
+ with patch.object(sys, 'argv', testargs):
+ parser.register()
+ def test_version_command(self):
+ testargs = ["onionr.py", "version"]
+ with patch.object(sys, 'argv', testargs):
+ parser.register()
+
+unittest.main()
\ No newline at end of file