Skip to content

Commit

Permalink
[show]: Remove default commands from groups as they are confusing to …
Browse files Browse the repository at this point in the history
…users (sonic-net#49)
  • Loading branch information
jleveque authored May 15, 2017
1 parent 7241394 commit b4a04cb
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,19 @@ def ip():

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

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

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

cmd_ifconfig = "/sbin/ifconfig"
Expand Down Expand Up @@ -263,19 +263,14 @@ def syseeprom():


#
# 'logging' group ####
# 'logging' command ####
#

@cli.group(cls=AliasedGroup, default_if_no_args=True)
def logging():
pass

# Default 'logging' command (called if no subcommands or their aliases were passed)
@logging.command(default=True)
@cli.command()
@click.argument('process', required=False)
@click.option('-l', '--lines')
@click.option('-f', '--follow', is_flag=True)
def default(process, lines, follow):
def logging(process, lines, follow):
"""Show system log"""
if follow:
run_command("sudo tail -f /var/log/syslog")
Expand Down

0 comments on commit b4a04cb

Please sign in to comment.