Skip to content

Commit e8a3342

Browse files
tarekbadrshafrittoli
authored andcommitted
first commit
1 parent 5c72e4a commit e8a3342

File tree

14 files changed

+862
-0
lines changed

14 files changed

+862
-0
lines changed

cli/MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include cdevents/configuration/configuration.yaml
2+
include cdevents/configuration/logging-configuration.yaml

cli/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include ../header.mk
2+
3+
SRC := cdevents/cli
4+
5+
MAKEFILE_LIST=../targets.mk
6+
7+
include $(MAKEFILE_LIST)

cli/README.md

Whitespace-only changes.

cli/cdevents/cli/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""CDEvents CLI provides command-line interaction with Cd-Event client functionality."""
2+
3+
__version__ = "0.0.1"

cli/cdevents/cli/__main__.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
"""Module for main entry point for cdevents.cli."""
2+
import logging
3+
import logging.config
4+
from pathlib import Path
5+
6+
import click
7+
import yaml
8+
9+
from cdevents.cli.constants import LOGGING_CONFIGURATION_FILE
10+
from cdevents.cli.build import finished, queued, started
11+
from cdevents.cli.utils import add_disclaimer_text
12+
13+
def configure_logging():
14+
"""Configures logging from file."""
15+
config_file = Path(LOGGING_CONFIGURATION_FILE)
16+
logging_config = yaml.safe_load(config_file.read_text(encoding="utf8"))
17+
logging.config.dictConfig(logging_config)
18+
19+
20+
@click.group(help=add_disclaimer_text("""Commands Build related CloudEvent."""))
21+
def build():
22+
"""Click group for command 'build'."""
23+
24+
build.add_command(finished)
25+
build.add_command(queued)
26+
build.add_command(started)
27+
28+
29+
# @click.group(help=add_disclaimer_text("""Commands with no interaction with hostlog."""))
30+
# def offline():
31+
# """Function for command group offline."""
32+
33+
34+
# offline.add_command(pcap_to_hdf5)
35+
# TODO: activate line when command is implemented
36+
# offline.add_command(visualize)
37+
# offline.add_command(create_dissector)
38+
# offline.add_command(convert_to_xviz)
39+
# offline.add_command(topic_configuration)
40+
41+
42+
# @click.group(help=add_disclaimer_text("Commands for local web UI."))
43+
# def web():
44+
# """Click group for command 'web'."""
45+
46+
47+
# web.add_command(web_start)
48+
49+
50+
@click.group(
51+
help=add_disclaimer_text(
52+
"""Main entry point for cdevents client cli.
53+
Select command group from Commands.
54+
Add '--help' to see more information about each subcommand, option and argument."""
55+
)
56+
)
57+
def cli():
58+
"""Main method for cli."""
59+
configure_logging()
60+
61+
62+
cli.add_command(build)
63+
# cli.add_command(offline)
64+
# cli.add_command(web)
65+
66+
if __name__ == "__main__":
67+
cli()

0 commit comments

Comments
 (0)