Question: best practice for duplicated options
See original GitHub issueFor example, now, I’m implementing Key
command with Cocona
. In detail, the command will have subcommands which handle key store, like list
, import
, at the key store placed. And the key store’s path should be set manually. As code…
class KeyCommand
{
public void List([Option]string? keyStorePath = null) { ... }
public void Import([Option]string? keyStorePath = null) { ... }
}
But the keyStorePath
option is duplicated though the option will be used over all subcommands in KeyStore
class. So I imagine some codes to remove the code duplication…
class KeyCommand
{
private readonly string _keyStorePath;
public KeyCommand([Option]string? keyStorePath = null) { _keyStorePath = keyStorePath ?? /**/; }
public void List() { ... }
public void Import() { ... }
}
Can you let me know the solution if it can be achieved with Cocona or considering it together through this issue?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Closing questions as exact duplications: 'best practice' - TeX
One of the concepts behind the StackExchange model is that questions which have the same underlying basis can be treated as duplicates, so...
Read more >Why are some questions marked as duplicate? - Help Center
The fundamental goal of closing duplicate questions is to help people find the right answer by getting all of those answers in one...
Read more >Tips for Handling Duplicate Cases in Survey Data
Identifying duplicates · Go to the Variables and Questions tab. · Change the Question Type for the variable IID – Interviewer Identification to ......
Read more >What is best practice for resolving duplicate ci's...
I usually delete the CI and map the records to the right CI. Another option is to add a state Duplicate on the...
Read more >Handling Duplicate Questions
Cut-and-paste duplicate questions. These questions are the very definition of exact duplicates; they are typically from users who willfully take ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Version 1.6 has now been released. Please try it out.
Sorry for the delay, but I have started to implement this feature/enhancement. 🙂 I am considering throwing a runtime error if the signature conflicts.