Skip to content

Commit

Permalink
Merge pull request #63 from InfuseAI/feature/sc-22500/add-admin-comma…
Browse files Browse the repository at this point in the history
…nd-in-the-available-command

Show admin command in the help
  • Loading branch information
qrtt1 authored Oct 26, 2021
2 parents 49d3942 + 075b5ad commit 6c96b1d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions primehub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def __init__(self, config: PrimeHubConfig):
self.register_command('apptemplates', 'AppTemplate')
self.register_command('apps', 'Apps')
self.register_command('models', 'Models')
self.register_dummy_command('admin', 'Commands for system administrator')

# register admin commands
self.register_admin_command('admin_datasets', 'AdminDatasets', 'datasets')
Expand Down Expand Up @@ -261,6 +262,11 @@ def register_command(self, module_name: str, command_class: Union[str, Callable]
# register to the commands table
self.commands[command_name] = clazz(self)

def register_dummy_command(self, command_name, command_help):

# register to the commands table
self.commands[command_name] = Dummy(self, command_help)

def register_admin_command(self, module_name: str, command_class: Union[str, Callable], command_name=None):
if not command_name:
command_name = module_name
Expand Down Expand Up @@ -371,6 +377,20 @@ def display(self, action: dict, value: Any):
self.get_display().display(action, value, self.primehub.stdout)


class Dummy(Helpful, Module):
"""
Dummy subcommand
"""
description = None

def __init__(self, primehub: PrimeHub, description):
super(Dummy, self).__init__(primehub)
self.description = description

def help_description(self):
return self.description


def has_data_from_stdin():
"""
Check if any data comes from stdin.
Expand Down
2 changes: 2 additions & 0 deletions tests/test_implementation_in_source_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def generate_doc_paths(command):
# skip version command
if command == 'version':
continue
if command == 'admin':
continue

notebook, cli, cli_example = generate_doc_paths(command)

Expand Down

0 comments on commit 6c96b1d

Please sign in to comment.