Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions linodecli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@
METHODS = ("get", "post", "put", "delete")

logger = getLogger(__name__)
args = sys.argv[1:]

if len(args) > 0 and args[-1] == "help":
sys.argv = [sys.argv[0]] + args[:-1] + ["--help"]
Comment thread
dhruveshmishra marked this conversation as resolved.

elif len(args) > 0 and args[0] == "help":
sys.argv = [sys.argv[0]] + args[1:] + ["--help"]
Comment thread
dhruveshmishra marked this conversation as resolved.

class CLI: # pylint: disable=too-many-instance-attributes
"""
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions tests/test_help_alias.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import subprocess
import os
def test_help_alias():
env = os.environ.copy()
env["LINODE_CLI_CONFIG"] = "/dev/null"
env["HOME"] = "/tmp"

result = subprocess.run(
["python3", "-m", "linodecli", "instance", "help"],
capture_output=True,
text=True,
timeout=5,
env=env,
input="\n"
)
Comment thread
dhruveshmishra marked this conversation as resolved.

assert result.returncode == 0
assert "usage" in result.stdout.lower()
Comment thread
dhruveshmishra marked this conversation as resolved.
Loading