dotnet / dotnet/command-line-api

Question: Best way to use different configs per command line arguement

Open
#1,532 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

I kind of feel like this has to be dumb question, but I'm looking for a decent way to use different configurations based on a command line flag. I have a CLI tool that I interact with different versions of a database (development, staging, production) and want to change the behavior based on an argument passed rather than an environment variable. I'm currently using dependency injection with System.CommandLine.Hosting. Any suggestions?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.