Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support global options #206

Open
ikkentim opened this issue Apr 29, 2021 · 3 comments
Open

Support global options #206

ikkentim opened this issue Apr 29, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request Typin Typin library related issues
Milestone

Comments

@ikkentim
Copy link

It would be nice if I could specify options which are globally available for all commands. For example git has a global --namespace=<name> option, which allows the namespace to be set for all (sub)commands.

I'd imagine in Typin, this would mean a global model could be set on the CliApplicationBuilder using builder.UseGlobalOptions<MyGlobalOptionsModel>() after which the model would be available through DI.

@ikkentim ikkentim added the concept Help and further investigation on the proposal is needed. label Apr 29, 2021
@adambajguz
Copy link
Owner

I haven't tested this, but you can propably use abstract base class to achive sth similar.

@supapo
Copy link

supapo commented Dec 7, 2021

The point is that the CommandOption attribute requires the class to have the Command attribute witch means that the abstract class must be an available command

@adambajguz
Copy link
Owner

adambajguz commented Dec 13, 2021

@ikkentim this will be implemented for Typin 4.0 due to the redesign of the library that will finally make it fully extensible. Probably global options will be implemented as a 'plugin'. I hope you don't mind waiting for it :)

@supapo I've verified this, and in terms of latest Typin release (3.0.4), there is no such limitation. I think that actually never did such a limitation exist. Abstract command DO NOT need CommandAttribute. CommandAttribute or OptionAttrbute DO NOT check for CommandAttribute. The only limitation is that you cannot have a interface with properties marked with CommandAttribute or OptionAttrbute because those attributes won't be read by Typin.

@adambajguz adambajguz added this to the v4.0 milestone Dec 13, 2021
@adambajguz adambajguz added enhancement New feature or request Typin Typin library related issues and removed concept Help and further investigation on the proposal is needed. labels Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Typin Typin library related issues
Projects
None yet
Development

No branches or pull requests

3 participants