Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev: ui_configure: Add completer for 'configure schema' command #1677

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
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
8 changes: 8 additions & 0 deletions crmsh/ui_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# Copyright (C) 2013 Kristoffer Gronlund <[email protected]>
# See COPYING for license information.

import os
import re
import time
import glob
from . import command
from . import completers as compl
from . import config
Expand Down Expand Up @@ -191,6 +193,11 @@ def ra_agent_for_cpt(cpt):
return agent


def schema_completer():
files = glob.glob(os.path.join('/usr/share/pacemaker/', 'pacemaker-*.rng'))
return [os.path.basename(f) for f in files]


class CompletionHelp(object):
'''
Print some help on whatever last word in the line.
Expand Down Expand Up @@ -958,6 +965,7 @@ def do_upgrade(self, context, force=None):
return cib_factory.upgrade_validate_with(force=config.core.force or force)

@command.skill_level('administrator')
@command.completers(compl.choice(schema_completer()))
def do_schema(self, context, schema_st=None):
"usage: schema [<schema>]"
if not schema_st:
Expand Down