Home

Awesome

Developer Documentation for TeCLI

Introduction

TeCLI is a source-generated CLI parsing library designed to simplify the development of command-line interfaces in .NET applications. It uses custom attributes to mark classes and methods as commands and subcommands, automatically generating the necessary parsing and dispatching logic.

Features

Getting Started

Installation

To use TeCLI in your project, add a reference to the TeCLI library. You can include it as a project in your solution or as a NuGet package if it is available in that form.

dotnet add package TeCLI
Basic Setup
  1. Define Commands

    Use the CommandAttribute to mark classes that represent CLI commands:

    using TeCLI;
    
    [Command("greet", Description = "Greets the user")]
    public class GreetCommand
    {
    }
    
  2. Define Actions

    Use the ActionAttribute for methods that should be executed as part of a command:

    [PrimaryAction(Description = "Say hello")]
    public void Hello(string name)
    {
        Console.WriteLine($"Hello, {name}!");
    }
    
Example Usage

To use the defined commands, ensure your application's entry point calls the generated CommandDispatcher:

public class Program
{
    public static void Main(string[] args)
    {
        CommandDispatcher.Dispatch(args);
    }
}

How to Define Commands

Commands are classes annotated with the CommandAttribute, which includes properties for the command name and an optional description. Each command can have multiple actions, which are methods annotated with ActionAttribute.

Extending Functionality

TeCLI is designed to be extensible:

FAQs

Contributing

Contributions are welcome! To contribute, please fork the repository, make your changes, and submit a pull request.

Conclusion

This documentation provides the basic information necessary for developers to get started with TeCLI, understand its structure, and begin integrating and extending it within their own projects. Make sure to expand on each section with more specific examples and detailed descriptions as needed to address all potential user concerns and use cases.