Add basic cli
Signed-off-by: Charles Short <charles.short@windriver.com>
This commit is contained in:
0
apt_ostree/cmd/__init__.py
Normal file
0
apt_ostree/cmd/__init__.py
Normal file
25
apt_ostree/cmd/shell.py
Normal file
25
apt_ostree/cmd/shell.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
"""
|
||||||
|
Copyright (c) 2023 Wind River Systems, Inc.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import click
|
||||||
|
|
||||||
|
from apt_ostree.cmd.version import version
|
||||||
|
|
||||||
|
|
||||||
|
@click.group(
|
||||||
|
help="\nHyrbid image/package management system."
|
||||||
|
)
|
||||||
|
@click.pass_context
|
||||||
|
def cli(ctx: click.Context):
|
||||||
|
ctx.ensure_object(dict)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
cli(prog_name="apt-ostree")
|
||||||
|
|
||||||
|
|
||||||
|
cli.add_command(version)
|
16
apt_ostree/cmd/version.py
Normal file
16
apt_ostree/cmd/version.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
Copyright (c) 2023 Wind River Systems, Inc.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import click
|
||||||
|
|
||||||
|
from apt_ostree.constants import VERSION
|
||||||
|
|
||||||
|
|
||||||
|
@click.command(name="version", help="Show version and exit.")
|
||||||
|
@click.pass_context
|
||||||
|
def version(ctxt):
|
||||||
|
print(VERSION)
|
8
apt_ostree/constants.py
Normal file
8
apt_ostree/constants.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
"""
|
||||||
|
Copyright (c) 2023 Wind River Systems, Inc.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
VERSION = "0.1"
|
@@ -1,28 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
"""
|
|
||||||
test_apt_ostree
|
|
||||||
----------------------------------
|
|
||||||
|
|
||||||
Tests for `apt_ostree` module.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from apt_ostree.tests import base
|
|
||||||
|
|
||||||
|
|
||||||
class TestApt_ostree(base.TestCase):
|
|
||||||
|
|
||||||
def test_something(self):
|
|
||||||
pass
|
|
13
apt_ostree/tests/test_cli.py
Normal file
13
apt_ostree/tests/test_cli.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from apt_ostree.tests import base
|
||||||
|
from apt_ostree.cmd.shell import cli
|
||||||
|
from click.testing import CliRunner
|
||||||
|
|
||||||
|
|
||||||
|
class Test_apt_cli(base.TestCase):
|
||||||
|
|
||||||
|
def test_something(self):
|
||||||
|
runner = CliRunner()
|
||||||
|
result = runner.invoke(cli, ["version"])
|
||||||
|
assert result.exit_code == 0
|
@@ -57,7 +57,7 @@ copyright = '2022, OpenStack Developers'
|
|||||||
|
|
||||||
# openstackdocstheme options
|
# openstackdocstheme options
|
||||||
openstackdocs_repo_name = 'starlingx/apt-ostree'
|
openstackdocs_repo_name = 'starlingx/apt-ostree'
|
||||||
openstackdocs_bug_project = 'replace with the name of the project on Launchpad or the ID from Storyboard'
|
openstackdocs_bug_project = ''
|
||||||
openstackdocs_bug_tag = ''
|
openstackdocs_bug_tag = ''
|
||||||
openstackdocs_auto_name = 'False'
|
openstackdocs_auto_name = 'False'
|
||||||
|
|
||||||
|
@@ -21,6 +21,10 @@ classifier =
|
|||||||
Programming Language :: Python :: 3 :: Only
|
Programming Language :: Python :: 3 :: Only
|
||||||
Programming Language :: Python :: Implementation :: CPython
|
Programming Language :: Python :: Implementation :: CPython
|
||||||
|
|
||||||
|
[entry_points]
|
||||||
|
console_scripts =
|
||||||
|
apt-ostree = apt_ostree.cmd.shell:main
|
||||||
|
|
||||||
[files]
|
[files]
|
||||||
packages =
|
packages =
|
||||||
apt_ostree
|
apt_ostree
|
||||||
|
@@ -9,3 +9,4 @@ python-subunit>=0.0.18 # Apache-2.0/BSD
|
|||||||
oslotest>=1.10.0 # Apache-2.0
|
oslotest>=1.10.0 # Apache-2.0
|
||||||
stestr>=1.0.0 # Apache-2.0
|
stestr>=1.0.0 # Apache-2.0
|
||||||
testtools>=1.4.0 # MIT
|
testtools>=1.4.0 # MIT
|
||||||
|
click
|
||||||
|
Reference in New Issue
Block a user