Skip to content

Commit 8eb9fdf

Browse files
helpsection
1 parent c66780b commit 8eb9fdf

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

linodecli/cli.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@
2525
METHODS = ("get", "post", "put", "delete")
2626

2727
logger = getLogger(__name__)
28+
args = sys.argv[1:]
2829

30+
if len(args) > 0 and args[-1] == "help":
31+
sys.argv = [sys.argv[0]] + args[:-1] + ["--help"]
32+
33+
elif len(args) > 0 and args[0] == "help":
34+
sys.argv = [sys.argv[0]] + args[1:] + ["--help"]
2935

3036
class CLI: # pylint: disable=too-many-instance-attributes
3137
"""

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/test_help_alias.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import subprocess
2+
import os
3+
def test_help_alias():
4+
env = os.environ.copy()
5+
env["LINODE_CLI_CONFIG"] = "/dev/null"
6+
env["HOME"] = "/tmp"
7+
8+
result = subprocess.run(
9+
["python3", "-m", "linodecli", "instance", "help"],
10+
capture_output=True,
11+
text=True,
12+
timeout=5,
13+
env=env,
14+
input="\n"
15+
)
16+
17+
assert result.returncode == 0
18+
assert "usage" in result.stdout.lower()

0 commit comments

Comments
 (0)