Skip to content

Commit b4a04cb

Browse files
authored
[show]: Remove default commands from groups as they are confusing to users (sonic-net#49)
1 parent 7241394 commit b4a04cb

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

show/main.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,19 @@ def ip():
124124

125125
# We use the "click.group()" decorator because we want to add this group
126126
# to more than one group, which we do using the "add_command() methods below.
127-
@click.group(cls=AliasedGroup, default_if_no_args=True)
127+
@click.group(cls=AliasedGroup, default_if_no_args=False)
128128
def interfaces():
129129
pass
130130

131131
# Add 'interfaces' group to both the root 'cli' group and the 'ip' subgroup
132132
cli.add_command(interfaces)
133133
ip.add_command(interfaces)
134134

135-
# Default 'interfaces' command (called if no subcommands or their aliases were passed)
136-
@interfaces.command(default=True)
135+
# 'summary' subcommand
136+
@interfaces.command()
137137
@click.argument('interfacename', required=False)
138138
@click.argument('sfp', required=False)
139-
def default(interfacename, sfp):
139+
def summary(interfacename, sfp):
140140
"""Show interface status and information"""
141141

142142
cmd_ifconfig = "/sbin/ifconfig"
@@ -263,19 +263,14 @@ def syseeprom():
263263

264264

265265
#
266-
# 'logging' group ####
266+
# 'logging' command ####
267267
#
268268

269-
@cli.group(cls=AliasedGroup, default_if_no_args=True)
270-
def logging():
271-
pass
272-
273-
# Default 'logging' command (called if no subcommands or their aliases were passed)
274-
@logging.command(default=True)
269+
@cli.command()
275270
@click.argument('process', required=False)
276271
@click.option('-l', '--lines')
277272
@click.option('-f', '--follow', is_flag=True)
278-
def default(process, lines, follow):
273+
def logging(process, lines, follow):
279274
"""Show system log"""
280275
if follow:
281276
run_command("sudo tail -f /var/log/syslog")

0 commit comments

Comments
 (0)