Created
April 16, 2023 15:29
-
-
Save Rahtoken/45587e6a55f0a7e3fcb45d8eee53b1d4 to your computer and use it in GitHub Desktop.
System.CommandLine Example
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
using System.CommandLine; | |
var queryArgument = new Argument<string?>( | |
name: "query", | |
description: "Ask magi your query!", | |
getDefaultValue: () => null); | |
var rootCommand = new RootCommand("magi - Microsoft Graph API's AI"); | |
rootCommand.AddArgument(queryArgument); | |
var configFileArgument = new Option<string?>( | |
name: "--config", | |
description: "magi uses this file as the config.", | |
getDefaultValue: () => null | |
); | |
rootCommand.AddGlobalOption(configFileArgument); | |
rootCommand.SetHandler(async (query, configFile) => | |
{ | |
// LLM + Microsoft Graph API here | |
}, queryArgument, configFileArgument); | |
return await rootCommand.InvokeAsync(args); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment