One-Fine-Day d679696ec0 CLI for Shipyard API
-Added cli folder
    -Utilizes click to process commands
	-commands can be found at
          https://github.com/att-comdev/shipyard/blob/master/docs/CLI.md
	-also, running the command 'shipyard'
         will give you a brief description of
         the commands available
    -Contains actions.py that calls Client API

-Added tests folder
    -Unit tests for commands
    -Negative unit tests are also included for
     commands
    -Unit tests for actions

Change-Id: Ie3e4d1f18aa935a311f332fba5c8a4d239183469
2017-11-08 14:28:08 -06:00

50 lines
1.5 KiB
Python

# Copyright 2017 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# help command
import click
from shipyard_client.cli.help.output import default, actions, configdocs
@click.group()
def help():
"""Shipyard Help Command"""
pass
@help.command(name='help')
@click.argument('topic', required=False)
@click.pass_context
def help(ctx, topic=None):
"""
Display detailed information on topics. \n
COMMAND: help \n
DESCRIPTION: Provides topical help for Shipyard. Note that --help will
provide more specific command help. \n
FORMAT: shipyard help <topic> \n
EXAMPLE: shipyard help configdocs \n
"""
if topic is None:
click.echo(default())
elif topic == 'actions':
click.echo(actions())
elif topic == 'configdocs':
click.echo(configdocs())
else:
ctx.fail("Invalid topic. Run command 'shipyard help' for a list of "
" available topics.")