57 lines
2.1 KiB
Python
57 lines
2.1 KiB
Python
"""
|
|
CLI argument parser for Clover - A terminal assistant for AI-powered project management
|
|
"""
|
|
|
|
import argparse
|
|
import sys
|
|
|
|
def parse_args():
|
|
"""
|
|
Parse command line arguments for Clover CLI
|
|
"""
|
|
parser = argparse.ArgumentParser(
|
|
prog='clover',
|
|
description='Clover - AI-powered terminal assistant for project management',
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
epilog="""
|
|
Examples:
|
|
clover /list # List available models
|
|
clover /init # Initialize project summary
|
|
clover /timeout 300 # Set timeout to 300 seconds
|
|
clover /threads 5 # Set thread limit to 5
|
|
clover "Write a Python function to calculate factorial"
|
|
"""
|
|
)
|
|
|
|
# Positional argument for general prompts (no leading slash)
|
|
parser.add_argument('prompt', nargs='?', help='Prompt for AI assistant')
|
|
|
|
# Command arguments (starting with /)
|
|
parser.add_argument('/list', action='store_true',
|
|
help='List available models on the server')
|
|
parser.add_argument('/init', action='store_true',
|
|
help='Initialize project summary file')
|
|
parser.add_argument('/timeout', type=int, metavar='SECONDS',
|
|
help='Set timeout duration for AI operations')
|
|
parser.add_argument('/threads', type=int, metavar='COUNT',
|
|
help='Set maximum number of threads for concurrent operations')
|
|
|
|
return parser.parse_args()
|
|
|
|
def print_help():
|
|
"""Print help message"""
|
|
print("Clover CLI Tool")
|
|
print("=" * 40)
|
|
print("Available commands:")
|
|
print(" /list - List available models on the server")
|
|
print(" /init - Initialize project summary file")
|
|
print(" /timeout SECS - Set timeout duration for AI operations")
|
|
print(" /threads N - Set maximum number of threads for concurrent operations")
|
|
print("")
|
|
print("Examples:")
|
|
print(" clover /list")
|
|
print(" clover /init")
|
|
print(" clover /timeout 300")
|
|
print(" clover /threads 5")
|
|
print(" clover \"Write a Python function to calculate factorial\"")
|