-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
92 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,25 @@ | ||
""" | ||
This module contains the main function for the DevChat CLI. | ||
""" | ||
import argparse | ||
import sys | ||
import click | ||
|
||
from devchat.utils import get_logger | ||
# pylint: disable=unused-import | ||
from devchat._cli import log | ||
from devchat._cli import prompt | ||
from devchat._cli import run | ||
from devchat._cli import topic | ||
from devchat._cli import route | ||
from devchat._cli import commands | ||
|
||
logger = get_logger(__name__) | ||
|
||
|
||
def main(argv=None): | ||
if argv is None: | ||
argv = sys.argv[1:] | ||
|
||
parser = argparse.ArgumentParser(description="CLI tool") | ||
subparsers = parser.add_subparsers(help='sub-command help') | ||
for _1, cmd in commands.items(): | ||
cmd.register(subparsers) | ||
@click.group() | ||
def main(): | ||
"""DevChat CLI: A command-line interface for DevChat.""" | ||
|
||
args = parser.parse_args(argv) | ||
if hasattr(args, 'func'): | ||
func_args = vars(args).copy() | ||
del func_args['func'] | ||
|
||
args.func(**func_args) | ||
else: | ||
parser.print_help() | ||
main.add_command(prompt) | ||
main.add_command(log) | ||
main.add_command(run) | ||
main.add_command(topic) | ||
main.add_command(route) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.